iOS 13 beta 2, openURL, with SourceApplication is nil

my app has been opened from other app (safari) by openURL, and the method " -(BOOL)application: openURL: sourceApplication: annotation: " been called, the issules is parameter sourceApplication is nil. In iOS 12 and earlier ,it will be the bundle id of other app (safari ).

Replies

I also encountered the same problem. I have to use the caller bundleID to make the judgment of the follow-up action. Can anyone help?

I'm partly guessing, but I think this may be a privacy feature. I was digging through the new window scene stuff and came across this for UISceneConnectionOoptions (in UISceneOptions.h)


// A NSString containing the bundle ID of the originating application.

// non-nil if the originating application and this application share the same team identifier.

@property (nullable, nonatomic, readonly) NSString *sourceApplication;



If you're not using scenes I presume some older API is being called instead. But that comment perhaps suggests you will only get the sourceApplication if that app is yours - it has the same team identifier. It seems quite plausible that restriction also applies to the older API.

Info update:

It's work when my app is close, but if by my app is in background, it can't fetch "sourceApplication" from caller.

There is another thread https://forums.developer.apple.com/thread/119118

I also have the same problem in iOS13."sourceApplication" is always for nil, how can I get "sourceApplication"? Can someone help me?

It is depreceated, you should use now:


- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)option

It seems this has changed in iOS 13 (it also affected our app, but I couldn't find any reference to this change in official docs). Anyway as per the current documentation:


If the team identifier of the originating app is different than the team identifier of the current app, the value of the key is

nil
.