私、
私は現在、次の方法でNSMutableデータをplistファイルに保存しようとしています。
[receivedData writeToFile:pathText atomically:YES]
受信したデータはURLrequestオブジェクトからのものであることに注意してください。これが私のコードです:
NSURLConnection *connection01 = [[NSURLConnection alloc] initWithRequest:request01 delegate:self];
if(connection01)
{
//3.Create NSMutableData to receive data
//receiveddata is an instance declared elsewhere
receivedData = [NSMutableData data];
}
以降
//6.Mettre les informations téléchargées dans un plist.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(@"DOCUMENT DIRECTORY: %@", documentsDirectory);
NSString *pathNom = [documentsDirectory stringByAppendingPathComponent:@"InformationsUser.plist"];
NSString *pathText = @"/Users/victorbielak/Desktop/InformationUser.text";
[receivedData writeToFile:pathText atomically:YES];
if (!documentsDirectory) {
NSLog(@"Documents directory not found!");
}
if(![[NSFileManager defaultManager] fileExistsAtPath:pathNom])
{
NSLog(@"file not found");
}
URLの下の情報が正しくダウンロードされていることを確認しましたが、「ファイルが見つかりません」というエラーメッセージが表示されます。誰かがそのコードに何が欠けているのか考えていますか?私は、plistがファイルへの書き込みメソッドによって自動的に生成されたと思います。
ご返信ありがとうございます。
ビクター