简单场景。我有一个设置了 URL 方案的应用程序。 例如
信息列表包含数组 URL 类型
该数组包含一个具有 2 个键的字典:URL 标识符(字符串(和 URL 方案(数组(
标识符等于捆绑 ID,方法是将其设置为 $(PRODUCT_BUNDLE_IDENTIFIER(。
在这种情况下,URL 方案仅包含 1 个值"深度链接测试"。在我的应用程序代表中,我实现了返回 true 的 application:openURL:options: 方法。
现在,当我转到 Safari(在模拟器或设备上(并键入"deeplink-test://"时,Safari 会询问我是否要打开该应用程序。我选择是,但没有调用深层链接。didFinishLaunchingWithOptions 也返回 true。知道为什么不调用 openURL 委托方法吗?这在前段时间曾经有效,但最近我注意到我们的深度链接不再得到正确处理。因此,应用将打开,但不调用委托方法。
我创建了一个具有相同实现的新项目。是否有我正在使用的 Pod 导致了问题?
豆荚:
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'
编辑- 添加了 plist 源代码:
<?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>icon@2x.png</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>
问题原来是我用于推送通知的 Pod(https://docs.accengage.com/display/IOS/SDK+Setup(。他们在设置过程中做一些奇怪的事情,并自动拦截应用程序委托方法,这些方法应该将其转发到应用程序。
不过它不能正常工作。