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]configuration文件'GoogleService-Info.plist'用于另一个包标识符('com.XXXXXX.mobility.appfactory.dev1.social')。 使用此文件可能无法正确configuration服务。 要继续使用此configuration文件,可以将应用程序的包标识符更改为“com.XXXXXX.mobility.appfactory.dev1.social”。 或者您可以从https:/ 2015-10-26 17:31:59.836下载与您的捆绑包标识符相匹配的新configuration文件GcmExampleSwift [360:] App measurement v.1100000开始2015-10-26 17:31:59.843 GcmExampleSwift [ 360:51727]成功configuration[CloudMessaging]。 2015-10-26 17:31:59.843 GcmExampleSwift [360:51727]configuration[]失败。 2015-10-26 17:31:59.843 GcmExampleSwift [360:51727]子类不存在,所以没有configuration[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:]networking状态已经改变。 代码,状态:2,连接2015-10-26 17:31:59.977:GGLInstanceID | 无法在caching中find令牌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不符。
首先,您需要将GoogleService-Info.plist
文件添加到正确的目标,如果您尝试使用GcmExampleSwift
,则应将其选为目标:
然后在你的GoogleService-Info.plist
文件中,如果你想使用com.XXXXXX.mobility.appfactory.dev1.social
作为你的捆绑ID,请确保你的BUNDLE_ID
键正确拼写:
最后,在您的目标中,请确保先selectGcmExampleSwift
(不是GcmExample
是Objective-C目标),然后使Bundle Identifier
与GoogleService-Info.plist
文件中的BUNDLE_ID
匹配: