【发布时间】:2018-06-15 19:22:10
【问题描述】:
我已通过 cocoapods 安装了 facebook sdk,但出现以下错误:
'sharedApplication' 不可用:在 iOS 上不可用(App 扩展) - 在适当的情况下使用基于视图控制器的解决方案 而是。
关于 FBSDKCoreKit/FBSDKAppEvents.m 中的第 701 行
UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController.presentedViewController;
为什么会发生这种情况,我该如何解决? 播客文件:
# Uncomment the next line to define a global platform for your
project
# platform :ios, '9.0'
target 'testapp' do
# Comment the next line if you're not using Swift and don't want to use dynamic
frameworks
use_frameworks!
# Pods for testapp
pod 'FLAnimatedImage', '~> 1.0'
pod 'SDWebImage', '~> 4.0'
pod 'FacebookLogin'
pod 'FacebookShare'
pod 'FacebookCore'
pod 'OneSignal', '>= 2.5.2', '< 3.0'
target 'testappTests' do
inherit! :search_paths
# Pods for testing
end
target 'OneSignalNotificationServiceExtension' do
pod 'OneSignal', '>= 2.5.2', '< 3.0'
end
target 'testappUITests' do
inherit! :search_paths
# Pods for testing
end
end
【问题讨论】: