我的应用中有一个通知扩展。但是,当我构建我的应用程序时,它与pod FBSDKLoginKit
冲突。它在FBSDKCoreKit中给我以下错误:
'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
我的Podfile看起来像这样(我错过了不相关的Pod):
workspace 'MyApp'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
project 'MyApp.xcodeproj'
pod 'FBSDKLoginKit'
pod 'OneSignal', '>= 2.6.2', '< 3.0'
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
end
我该如何解决?
将OneSignalNotificationServiceExtension
目标移出Podfile中的主要目标。不要忘记在其中也定义use_frameworks!
!
workspace 'MyApp'
platform :ios, '10.0'
target 'MyApp' do
use_frameworks!
project 'MyApp.xcodeproj'
pod 'FBSDKLoginKit'
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignal', '>= 2.6.2', '< 3.0'
end
清理并构建,应该可以解决问题👍