NewsstandKitに移行して、バックグラウンドダウンロードの恩恵を受けようとしています。NKAssetDownload destinationURLがファイルまたはディレクトリとして存在しません
NKAssetDownloadを開始して代理人を設定できるようになりました。しかし、ダウンロードしたコンテンツを入手するには、ファイルシステムから取得することができません。
特定のパラメータを持つコンテンツをCMSに照会していますが、ファイルのダウンロードが返されます。ダウンロードは正常に進行しますが、その後にファイルが見つかりません。
これはダウンロードデリゲートに対応するコードです:
- (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL {
#if DEBUG
NSLog(@"NewsstandTracker.m connectionDidFinishDownloading destinationURL:%@",destinationURL);
NSLog(@"========= destination url contents =======");
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
NSError *error = nil;
BOOL isdir = 0;
BOOL exists = [manager fileExistsAtPath:[destinationURL absoluteString] isDirectory:&isdir];
NSLog(@"file exists: %d isDir:%d",exists,isdir);
NSLog(@"error: %@",error);
NSString *f = [[[assetDownload URLRequest] URL] lastPathComponent];
NSDirectoryEnumerator * enumerator = [manager enumeratorAtPath:[[destinationURL absoluteString]stringByAppendingPathComponent:f]];
for (NSString *url in enumerator) {
NSLog(@"%@",url);
}
NSLog(@"======= contentURL contents =======");
manager = [[[NSFileManager alloc] init] autorelease];
NSDirectoryEnumerator * en = [manager enumeratorAtPath:[[[self getNewsstandIssue] contentURL] absoluteString]];
for (NSString *url in en) {
NSLog(@"%@",url);
}
#endif
//do more stuff according to NewsstandKit docs
これは、私も行うことができます前に、何とかがダウンロードを片付けているように見えるコンソール
2012-01-02 16:01:45.843[499:707] NewsstandKit: cleaning up abandoned asset downloads: (
"<NKAssetDownload: 0x36dc510> -> {identifier: '75F48F44-ADF9-4F83-ABF6-5C03F57524C1/508E80A2-A8AA-4DD1-A979-715395E4E8DD' request: <NSURLRequest http://server-content/getFreeIssue/a_product_id> downloading: NO}"
)
2012-01-02 16:02:43.613[499:707] NewsstandTracker.m connectionDidFinishDownloading destinationURL:file://localhost/private/var/mobile/Applications/992490C5-2607-4942-B06D-4EE9CD6226E4/Library/Caches/bgdl-499-2e4c509b06864f5c.issue23
2012-01-02 16:02:43.614[499:707] ========= destination url contents =======
2012-01-02 16:02:43.614[499:707] file exists: 0 isDir:0
2012-01-02 16:02:43.615[499:707] error: (null)
2012-01-02 16:02:43.616 GSMagazine[499:707] ======= contentURL contents =======
の出力でありますそれと何か。
手がかりはありますか?
以下のいずれかの解決策が問題を解決したか、解決策を見つけましたか(または放棄しましたか)。 –