【发布时间】:2017-06-08 02:32:52
【问题描述】:
让我先说我正在使用CocoaPods 来管理我的框架。我不确定这是否真的很重要,但我想你最好知道以防万一。我也在 iOS 10.x 上运行最新版本的 Xcode(非测试版)。
我的应用在Fabric.with([Crashlytics.self, PubNub.self]) 上崩溃并出现以下错误:
由于未捕获的异常“FABException”而终止应用程序,原因:“[Fabric] “PubNub”似乎不是有效的 Fabric Kit。请确保您只将 Fabric Kits 传递给 [Fabric with:]。'
我更新了我的PodFile,清理了我的项目,运行全新安装,在物理和虚拟设备上运行,我什至卸载了pod 'PubNub' 并重新安装了它。到目前为止似乎没有任何工作,所以任何帮助将不胜感激。
我的AppDelegate 看起来像这样:
import Fabric
import Crashlytics
import PubNub
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
/* Fabric (Answers) Debug */
Fabric.sharedSDK().debug = true
/* Fabric Setup */
Fabric.with([Crashlytics.self, PubNub.self])
return true
}
我的PodFile 看起来像这样:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.1'
target 'AppName' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Fabric #
pod 'Fabric'
pod 'Crashlytics', '~> 3.8'
# PubNub #
pod 'PubNub/Fabric'
target 'AppNameTests' do
inherit! :search_paths
# Pods for testing
end
target 'AppNameUITests' do
inherit! :search_paths
# Pods for testing
end
end
我的Info.plist 代码:
<key>Fabric</key>
<dict>
<key>APIKey</key>
<string>##############################</string>
<key>Kits</key>
<array>
<dict>
<key>KitInfo</key>
<dict/>
<key>KitName</key>
<string>Crashlytics</string>
</dict>
<dict>
<key>KitInfo</key>
<dict>
<key>publish-key</key>
<string>##############################</string>
<key>secret-key</key>
<string>##############################</string>
<key>subscribe-key</key>
<string>##############################</string>
</dict>
<key>KitName</key>
<string>PubNub</string>
</dict>
</array>
</dict>
【问题讨论】:
-
您是否将 pubnub 添加到您的
Info.plist中的 Fabric 字典中? -
为什么你的 PubNub pod 写成
pod 'PubNub/Fabric'?我浏览了 Fabric 文档,找不到任何要求您将“/Fabric”附加到第三方工具包末尾的内容。您是否尝试过仅使用pod 'PubNub'? -
另外,不要忘记将您的 Fabric 信息添加到
Info.plist,就像上面提到的 @u.gen 一样。这是example article -
@gurooj 设置为
pod 'PubNub/Fabric'因为我想更轻松地在 Fabric 中接收 PubNub 事件。可以在here 找到引用此 pod 安装过程的安装说明。 -
@u.gen 是的,我已将 PubNub 添加到
Info.plist中的 Fabric 字典数组中。我已经编辑了我的问题以显示此代码。
标签: ios swift pubnub twitter-fabric google-fabric