iPhone: Can access files in documents directory in Simulator, but not device

眉间皱痕 提交于 2019-12-03 21:59:03

It turned out to be an issue where the bundle was not being updated on the device and apparently didn't have the same set of files that the Simulator had. This blog post helped a bit: http://majicjungle.com/blog/?p=123

Basically, I cleaned the build and delete the app and installed directly to the device first instead of the simulator. Interesting stuff.

I don't see where documentsDirectory is defined.

NSString *destinationPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%d", [[[manifest objectAtIndex:i] valueForKey:@"publicationID"] intValue]]];

Perhaps the following will do the trick

NSString *destinationPath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:[NSString stringWithFormat:@"%d", [[[manifest objectAtIndex:i] valueForKey:@"publicationID"] intValue]]];

Your copy code looks fine, and you say you're getting no errors.

But I'm intrigued by "The assets just come up as null." Are you sure you're accessing the file name later with the exact same name?

Unlike the simulator, a real iPhone has a case sensitive file system.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!