こんにちは私は目的のCを使用してURLからローカル電話機ストレージにファイルをダウンロードする方法を示すよいチュートリアルを依頼したい 私は以下の同期を行っていますが、URLからのアシンクダウンロード
NSString* docsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* fileToDownload = @"data1.plist";
NSString* hostURLString = @"http://localhost/test";
hostURLString = [hostURLString stringByAppendingPathComponent: fileToDownload];
NSURL* pListURL = [NSURL URLWithString: hostURLString];
NSData* pListData = [NSData dataWithContentsOfURL: pListURL];
NSString* filePath = [docsDir stringByAppendingPathComponent: fileToDownload];
[pListData writeToFile: filePath atomically: NO];
NSString* Path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *DataPath = [Path stringByAppendingPathComponent:@"data1.plist"];
任意の提案
可能重複[iPhone:\に対立するものとしてNSURL要求とは非同期にデータをダウンロードする[NSDataのdatawithContents ofURL \]](http://stackoverflow.com/questions/6012612/iphone-downloading-data-asynchronously- with-nsurl-request-as-to-nsdata) –
次のリンクを試してください。非同期で作成してダウンロードするように指示することがあります。 1. http://stackoverflow.com/questions/6820512/async-images-download-in-a-table 2. http://stackoverflow.com/questions/6012612/iphone-downloading-data-asynchronously-with-with- nsurl-request-as-to-nsdata – iOS