【问题标题】:App crashing because "It appears that 'PubNub' is not a valid Fabric Kit"应用程序崩溃,因为“'PubNub' 似乎不是有效的 Fabric Kit”
【发布时间】: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


【解决方案1】:

我是 Fabric 的工程师。我尝试重现您上面描述的问题,但无法这样做。新的 Swift 项目和 PubNub/Fabric Cocoapod 似乎一切正常。我唯一的怀疑是您以某种方式最终在项目中使用了 PubNub 的非结构构建。如果还有什么我可以提供的帮助,请随时与我们联系!

【讨论】:

  • 感谢您的帮助!如果是这种情况,我将如何删除旧的 PubNub 构建并安装新的 Fabric-build?
  • 可以尝试几件事:删除工作区中的 Pods 文件夹并重新运行“pod install”。如果您仍然遇到问题,请尝试在新的 Xcode 项目中运行它,看看这是否适合您。
猜你喜欢
  • 1970-01-01
  • 2017-08-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-03
  • 2014-04-28
  • 2020-04-03
  • 2016-12-30
相关资源
最近更新 更多