Search code examples
iosxcodedelegatesdeep-linkingdeeplink

application:openURL:options: not called after deeplink


Simple scenario. I have an app with URL schemes setup. e.g.

infoplist contains an Array URL types

That array contains a dictionary with 2 keys: URL identifier (String) and URL Schemes (Array)

Identifier is equal to the bundle id by setting it to $(PRODUCT_BUNDLE_IDENTIFIER).

URL Schemes only contains 1 value "deeplink-test" in this case. In my AppDelegate I have the application:openURL:options: method implemented that returns true.

Now when I go to Safari (on the simulator or device) and type "deeplink-test://" Safari asks me if I want to open the app. I select yes but the deeplink is not called. didFinishLaunchingWithOptions is returning true as well. Any idea why the openURL delegate method is not being called? This used to work some time ago but recently I noticed our deeplinks we're not being handled correctly anymore. So the app will open, but the delegate method is not called.

I created a new project with the same implementation where it does work. Is there maybe a Pod that I'm using that is causing the problems?

Pods:

pod 'Apollo' pod 'ReactiveObjC' pod 'Underscore.m' pod 'Masonry' pod 'Locksmith' pod 'INTULocationManager' pod 'GoogleAnalytics' pod 'GoogleTagManager' pod 'GoogleAppIndexing' pod 'GoogleSignIn' pod 'Firebase/Core' pod 'Firebase/Auth' pod 'Firebase/Messaging' pod 'HockeySDK' pod 'Adjust' pod 'UIDevice-Hardware' pod 'Accengage-iOS-SDK' pod 'MultiDelegate' pod 'SwipeView' pod 'DZNEmptyDataSet' pod 'FBSDKLoginKit' pod 'PINCache' pod 'FCFileManager' pod 'SnapKit' pod 'GoogleMaps' pod 'GooglePlaces' pod 'RSKGrowingTextView' pod 'FlexiblePageControl' pod 'SwiftyBeaver' pod 'Crashlytics' pod 'Fabric' pod 'React', :path => '../../node_modules/react-native', :subspecs => [ 'Core', 'RCTText', 'RCTNetwork', 'RCTWebSocket', 'RCTLinkingIOS', 'RCTImage', 'RCTAnimation', 'RCTActionSheet' ] pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga' pod 'CodePush', :path => '../../node_modules/react-native-code-push' pod 'RNDeviceInfo', :path => '../../node_modules/react-native-device-info' pod 'react-native-cookies', :path => '../../node_modules/react-native-cookies' pod 'react-native-navigation', :path => '../../node_modules/react-native-navigation' pod 'react-native-video', :path => '../../node_modules/react-native-video'

EDIT - added plist source code:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>xx.xxx.xxx</string> <key>CFBundleURLSchemes</key> <array> <string>deeplink-test-again</string> </array> </dict> </array> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleDisplayName</key> <string>${PRODUCT_NAME} ${BUNDLE_DISPLAY_NAME_SUFFIX}</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIcons</key> <dict/> <key>CFBundleIcons~ipad</key> <dict/> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>${PRODUCT_NAME}</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>11.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>105</string> <key>Fabric</key> <dict> <key>APIKey</key> <string>xx.xxx.xxx</string> <key>Kits</key> <array> <dict> <key>KitInfo</key> <dict/> <key>KitName</key> <string>Crashlytics</string> </dict> </array> </dict> <key>FacebookAppID</key> <string>xx.xxx.xxx</string> <key>FacebookDisplayName</key> <string>xx.xxx.xxx</string> <key>ITSAppUsesNonExemptEncryption</key> <false/> <key>Icon files (iOS 6)</key> <dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconFiles</key> <array> <string>icon.png</string> <string>[email protected]</string> </array> <key>UIPrerenderedIcon</key> <true/> </dict> </dict> <key>LSApplicationQueriesSchemes</key> <array> <string>comgooglemaps</string> <string>bma4sreceiver</string> <string>xx.xxx.xxx</string> <string>fbapi</string> <string>fb-messenger-share-api</string> <string>fbauth2</string> <string>fbshareextension</string> </array> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>xx.xxx.xxx</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>facebook.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>fbcdn.net</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict> <key>NSCalendarsUsageDescription</key> <string>xx.xxx.xxx</string> <key>NSCameraUsageDescription</key> <string>xx.xxx.xxx</string> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <string>xx.xxx.xxx</string> <key>NSLocationAlwaysUsageDescription</key> <string>xx.xxx.xxx</string> <key>NSLocationWhenInUseUsageDescription</key> <string>xx.xxx.xxx</string> <key>NSPhotoLibraryAddUsageDescription</key> <string>xx.xxx.xxx</string> <key>NSPhotoLibraryUsageDescription</key> <string>xx.xxx.xxx</string> <key>UIBackgroundModes</key> <array> <string>remote-notification</string> </array> <key>UILaunchStoryboardName</key> <string>xx.xxx.xxx</string> <key>UIPrerenderedIcon</key> <true/> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string> </array> <key>UIRequiresFullScreen</key> <true/> <key>UIStatusBarHidden</key> <false/> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UIViewControllerBasedStatusBarAppearance</key> <true/> </dict> </plist>


Solution

  • The problem turned out to be a Pod that I was using for push notifications (https://docs.accengage.com/display/IOS/SDK+Setup). They do something weird during the setup and automatically intercepting the application delegate methods which should forward it then to the app.

    It doesn't work correctly though.