【问题标题】:GoogleCloudMessaging linked errorGoogleCloudMessaging 链接错误
【发布时间】:2016-01-30 13:13:46
【问题描述】:

我需要在我的应用中使用 GoogleCloudMessaging。我通过 Cocoapods 安装了它。 当我添加这部分代码时:

GLInstanceIDConfig *instanceIDConfig = [GGLInstanceIDConfig defaultConfig];
    instanceIDConfig.delegate = self;
    // Start the GGLInstanceID shared instance with the that config and request a registration
    // token to enable reception of notifications
    [[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
    _registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                             kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};
    [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:GCMSSenderID
                                                        scope:kGGLInstanceIDScopeGCM
                                                      options:_registrationOptions
                                                      handler:_registrationHandler];

我有这些错误:

架构 x86_64 的未定义符号:
“_OBJC_CLASS_$_GGLInstanceID”,引用自: AppDelegate.o "_OBJC_CLASS_$_GGLInstanceIDConfig" 中的 objc-class-ref,引用自: AppDelegate.o "_kGGLInstanceIDAPNSServerTypeSandboxOption" 中的 objc-class-ref,引用自: -[AppDelegate 应用程序:didRegisterForRemoteNotificationsWithDeviceToken:] 在 AppDelegate.o“_kGGLInstanceIDRegisterAPNSOption”,引用自: -[AppDelegate 应用程序:didRegisterForRemoteNotificationsWithDeviceToken:] 在 AppDelegate.o "_kGGLInstanceIDScopeGCM",引用自: -[AppDelegate 应用程序:didRegisterForRemoteNotificationsWithDeviceToken:] 在 AppDelegate.o ld:未找到架构 x86_64 的符号 错误:链接器命令失败,退出代码为 1(使用 -v 查看 调用)

项目设置:

-> 仅构建活动架构 - 是

-> 其他链接标志包含 $(inherited)

-> 部署目标 - 8.0

请帮帮我! 提前致谢!

【问题讨论】:

  • 确保您正在构建工作区,而不是项目,因为 CocoaPods 是工作区中的另一个独立项目

标签: ios objective-c google-cloud-messaging


【解决方案1】:

检查 4 件事:

  1. 您尚未在项目中手动上传 GoogleCloudMessaging。如果有,请删除它们并重新安装 pod。

  2. 检查您的构建设置中的链接器路径设置。在安装 pod 之前使用 '$inherited'。

  3. 重新安装 pod 后,使用 cmd + shift + k 清理您的项目,然后运行您的项目。

  4. 仅构建活动架构 - 否,针对目标 - 是

【讨论】:

    【解决方案2】:

    此错误是因为您的项目中缺少一些库。

    签入您的Build Phases -> Link Binary With Libraries。您的任何框架都可能已从那里删除。

    添加它并清理并构建您的项目。

    也许对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2012-12-24
      • 2014-02-13
      • 2014-06-23
      • 2010-12-03
      相关资源
      最近更新 更多