0

私はここで初めてです、助けてください。特定の URL (例: www.example.com./file.pdf ) から .epub または .pdf をダウンロードし、特定の名前 (整数) で iOS デバイスに保存します。自分の欲しい本かどうかを確認することができます。

4

2 に答える 2

1

このコードを ur view did load またはその他のメソッドに追加します

NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.feedbooks.com/book/3471.epub"]];

//Store the Data locally as epub  File if u want pdf change the file extension  

NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle]  resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];

NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@"3471.epub"];

[pdfData writeToFile:filePath atomically:YES];
NSLog(@"%@",filePath);
于 2013-03-15T05:21:11.397 に答える
0

あなたが適切にグーグルするならば、これに利用できるいくつかの解決策があります。

ただし、とにかく、目的に応じてhttps://github.com/AFNetworking/AFNetworkingまたはhttps://github.com/pokeb/asi-http-request を使用できます。

https://github.com/PSPDFKit/PSPDFKit-Demoおよびhttps://github.com/steipete/AFDownloadRequestOperationを参照して参照できる例もいくつかあります。

ePubリーダーの場合は、おそらくこのリンクをたどることができますhttp://ideveloperworld.blogspot.in/2011/02/epub-reader.html

于 2013-03-14T05:21:25.480 に答える