Posts tagged in-app purchases

iOS 8 Directory Structure and In-App Purchase Downloads Problems

With iOS 8, every new build of your application will most likely be stored in a different container. This means that any file system paths you store to downloads or documents may change between builds.

While debugging some In-App purchase code I came across the following problem. I would start an In-App purchase with Apple hosted downloads, then just before the download completed, I stopped the App using Xcode. When I rebuild and run the app, the download would complete as normal and the download state was set to SKDownloadStateFinished. All good, with one exception: the path that download.contentURL contains, is pointing to a different app container, the original container from the previous build. A container that we don’t have access to, which will cause our move operation to fail!

This is one of those bugs that you’re probably not going to come across very often, but when you do it’ll eat up just enough of your time to annoy you! I’m assuming that the same error could occur if the user kills the app, updates it from the App Store, and then restarts. Now, off to file a radar…