UIApplicationLaunchOptionsURLKey not accessible

My didFinishLaunchingWithOptions method stores a filename from the UIApplicationLaunchOptionsURLKey and tries to open it.


-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

    NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];

    NSError* err;

    if ([url checkResourcesIsReachableAndReturnError:&err])

    { ... }


}


For iOS 8 this code works fine. My application is launched because some other application selected "open in" to my application, but for iOS 9 this code doesn't work, and I get


err = NSCocoaErrorDomain : code 257 : "The file 'XXX' couldn't be opened because you don't have permission to view it."

"The operation couldn't be completed. Operation not permitted"


!!Very important note!!: This only happens when my application was shut down while the user tried to open a file from another application. If it was not shut down, just minimized, everything behaves well.


Please help


Thanks

Nili

Answered by Nili at WatchDox in 31190022

This was a problem in iOS 9 beta 3 that was resolved in beta 4.

didFinishLaunchingWithOptions method was triggered with a filename in the UIApplicationLaunchOptionsURLKey that was in a different application's space, hence it was sandboxed and the iOS application could not access it. Anyhow Apple now resolved this issue.

Accepted Answer

This was a problem in iOS 9 beta 3 that was resolved in beta 4.

didFinishLaunchingWithOptions method was triggered with a filename in the UIApplicationLaunchOptionsURLKey that was in a different application's space, hence it was sandboxed and the iOS application could not access it. Anyhow Apple now resolved this issue.

UIApplicationLaunchOptionsURLKey not accessible
 
 
Q