GCM在Swift Bundle ID错误 [英] GCM in Swift Bundle ID Error

查看:205
本文介绍了GCM在Swift Bundle ID错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Swift中执行Google Cloud Messaging时遇到问题。使用 GCMExample 获取注册令牌,但是当我尝试运行Swift时, GCMExampleSwift 出错。我为Objective C和Swift使用了相同的'GoogleService-Info.plist'。


2015-10-26 17:31 :59.834 GcmExampleSwift [360:51727]配置
文件'GoogleService-Info.plist'用于另一个包标识符
('com.XXXXXX.mobility.appfactory.dev1.social')。使用这个文件
服务可能没有正确配置。要继续使用此
配置文件,您可以将应用程序的包标识符更改为
'com.XXXXXX.mobility.appfactory.dev1.social'。或者,您可以下载一个
的新配置文件,该文件与
中的捆绑标识符相匹配https:/ 2015-10-26 17:31:59.836 GcmExampleSwift [360:] App
测量v.1100000开始2015-10-26 17:31:59.843
GcmExampleSwift [360:51727]成功配置[CloudMessaging]。
2015-10-26 17:31:59.843 GcmExampleSwift [360:51727]未能配置
[]。 2015-10-26 17:31:59.843 GcmExampleSwift [360:51727] Subspecs不是
,因此未配置[Analytics,AdMob,SignIn,AppInvite,
Maps]。 2015-10-26 17:31:59.843 GcmExampleSwift [360:51727]预计会出现子类
[CloudMessaging,Measurement]。 2015-10-26
17:31:59.936 GcmExampleSwift [360:]网络状态更改
。代码,状态:2,连接2015-10-26 17:31:59.977:
GGLInstanceID |无法在缓存中找到令牌Error
Domain = com.google.iid Code = -25300(null)注册GCM失败
,错误:无法完成操作。
(com.google.HTTPStatus错误401.)2015-10-26 17:32:01.053
GcmExampleSwift [360:51727] - 在变换层中更改
属性masksToBounds没有影响
2015-10-26 17:32:01.053 GcmExampleSwift [360:51727] - 改变属性masksToBounds在变换只
图层中,将没有任何效果2015-10-26 17:32:01.053
GcmExampleSwift [360:51727] - 在仅变换图层中更改
属性masksToBounds将不起作用


解决方案

在您的 GoogleService-Info.plist中看到Bundle ID 与您的目标中的包ID不匹配。

b
$ b

首先,您需要将 GoogleService-Info.plist 文件添加到正确的目标,如果您尝试使用 GcmExampleSwift ,你应该选择它作为目标:

然后在你的 GoogleService-Info.plist 文件中,如果你想要要使用 com.XXXXXX.mobility.appfactory.dev1.social 作为您的套餐ID,请确保您正确拼写 BUNDLE_ID 键:





最后,在你的目标,确保你先选择 GcmExampleSwift (不是 GcmExample 这是Objective-C目标),然后使 Bundle Identifier 与您的 GoogleService-Info.plist BUNDLE_ID 匹配c $ c> file:




I am having trouble in executing Google Cloud Messaging in Swift. Using GCMExample for objective C I am getting the Registration token but when I am trying to run GCMExampleSwift which is for Swift I am getting an error. I am using the the same 'GoogleService-Info.plist' for both Objective C and Swift.

2015-10-26 17:31:59.834 GcmExampleSwift[360:51727] The configuration file 'GoogleService-Info.plist' is for another bundle identifier ('com.XXXXXX.mobility.appfactory.dev1.social'). Using this file the services may not be configured correctly. To continue with this configuration file, you may change your app's bundle identifier to 'com.XXXXXX.mobility.appfactory.dev1.social'. Or you can download a new configuration file that matches your bundle identifier from https:/ 2015-10-26 17:31:59.836 GcmExampleSwift[360:] App measurement v.1100000 started 2015-10-26 17:31:59.843 GcmExampleSwift[360:51727] Successfully configured [CloudMessaging]. 2015-10-26 17:31:59.843 GcmExampleSwift[360:51727] Failed to configure []. 2015-10-26 17:31:59.843 GcmExampleSwift[360:51727] Subspecs not present, so not configured [Analytics, AdMob, SignIn, AppInvite, Maps]. 2015-10-26 17:31:59.843 GcmExampleSwift[360:51727] Subspecs expected to be present [CloudMessaging, Measurement]. 2015-10-26 17:31:59.936 GcmExampleSwift[360:] Network status has changed. code, status: 2, Connected 2015-10-26 17:31:59.977: GGLInstanceID | Unable to find token in cache Error Domain=com.google.iid Code=-25300 "(null)" Registration to GCM failed with error: The operation couldn’t be completed. (com.google.HTTPStatus error 401.) 2015-10-26 17:32:01.053 GcmExampleSwift[360:51727] - changing property masksToBounds in transform-only layer, will have no effect 2015-10-26 17:32:01.053 GcmExampleSwift[360:51727] - changing property masksToBounds in transform-only layer, will have no effect 2015-10-26 17:32:01.053 GcmExampleSwift[360:51727] - changing property masksToBounds in transform-only layer, will have no effect

解决方案

Seems the Bundle ID in your GoogleService-Info.plist does not match the bundle ID in your target.

First you need to add the GoogleService-Info.plist file to a correct target, if you are trying the GcmExampleSwift, you should select that as the target:

Then in your GoogleService-Info.plist file, if you want to use com.XXXXXX.mobility.appfactory.dev1.social as your bundle ID, make sure you spell it correctly in for the BUNDLE_ID key:

Finally, in your targets, make sure you select the GcmExampleSwift first (NOT the GcmExample which is the Objective - C target), then make the the Bundle Identifier matches the BUNDLE_ID in your GoogleService-Info.plist file:

这篇关于GCM在Swift Bundle ID错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆