title: ios 8: Bundle path changes
body: <p>I have an iOS app that stores the absolute path of files in a database and in generated html documents. I just recently updated my iPhone to iOS 8 and now when ever I run the app it seems that the app is installed in a different directory every re-compile. For example on the first build/run [[NSBundle mainBundle] bundlePath] returns something different on the next build/run. What is going on? Is this a new feature of Apple?</p>
  
  <p>Update: A bug report was created</p>
  
  <p>Code example:</p>
  
  <p>If I run the following line over multiple build/runs then I will get a different result each time.</p>
  
  <pre><code>#define kOLD_PATH @"oldPath"
  NSString* newPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
  NSString* oldPath = [[NSUserDefaults standardUserDefaults] objectForKey:kOLD_PATH];
  
  NSLog(@"New Path: %@", newPath);
  NSLog(@"Old Path: %@", oldPath);
  NSLog(@"Result: %@", [oldPath isEqualToString:newPath] ? @"Same" : @"Changed");
  
  [[NSUserDefaults standardUserDefaults] setObject:newPath forKey:kOLD_PATH];
  [[NSUserDefaults standardUserDefaults] synchronize];
  </code></pre>
  
  <p>The output looks like this over multiple runs</p>
  
  <pre><code>New Path: /var/mobile/Containers/Data/Application/4FFCE2CB-580D-409A-90CB-EF2B8A1FB653/Library
  Old Path: /var/mobile/Containers/Data/Application/B038B2DA-F85D-4E18-A5F1-8635834EC454/Library
  Result: Changed
  </code></pre>
  
  <p><strong>Full Disclosure:</strong> In my app the user imports a web page (ePub) that has resources. The resources are stored with the web page. The web page also accesses resources that are part of the app bundle. To achieve this when I load the web page the base url is set to the directory the web page is in and the bundle resources are accessed via absolute file paths. Now that file paths change on every update this is broken. I tried creating symbolic links to the bundle resources but that also fails un subsequent updates. </p>