应用程序崩溃,因为“似乎'PubNub'不是一个有效的Fabric工具包”

时间:2017-06-08 02:32:52

标签: ios swift pubnub twitter-fabric google-fabric

让我先说我正在使用CocoaPods来管理我的框架。我不确定这是否真的很重要,但我认为你可能也知道以防万一。我也在iOS 10.x上运行最新版本的Xcode(不是beta版)。

我的应用程序在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>

1 个答案:

答案 0 :(得分:3)

我是Fabric的工程师。我尝试重现你上面描述的问题,但未能这样做。使用全新的Swift项目和PubNub / Fabric Cocoapod似乎可以正常工作。我唯一怀疑的是你以某种方式结束了项目中非Fabric版本的PubNub。如果还有其他任何我可以提供的帮助,请随时与我们联系!