使用GCM for iOS app注册时出错

时间:2015-08-17 07:25:23

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

我正在使用Google instructions link将GCM与iOS应用集成。

我按照说明在我的项目中集成了Cocoapod文件。安装完成后,我在GGLConfiguration.h和GGLInstanceID.h中收到如下错误,如下面的屏幕截图所示:

在appdelegate.m中添加以下代码段时出现此问题

  #import "AppDelegate.h" 

 //***** this code *****//
  @interface AppDelegate ()
  @property(nonatomic, strong) void (^registrationHandler)
       (NSString *registrationToken, NSError *error);
  @property(nonatomic, assign) BOOL connectedToGCM;
  @property(nonatomic, strong) NSString* registrationToken;
  @property(nonatomic, assign) BOOL subscribedToTopic;
  @end


 and in appdelegate.h

 #import <Google/CloudMessaging.h>
  //***************/

enter image description here

如果有人遇到类似的问题,请帮助我..

感谢任何帮助。

2 个答案:

答案 0 :(得分:3)

看起来您需要为Objective-C项目启用模块。

在您的构建设置中,它看起来像这样:

可以看到更多信息in this very related question

P.S。

我不确定哪些模块被禁用与&#34; 1003&#34;错误,b.t.w。您的代码的哪一部分会产生错误?你有多个问题要组合在一起吗?

答案 1 :(得分:1)

通过替换:

解决了我的问题
   @import UIKit

   @import Foundation

   // to

   #import <UIKit/UIKit.h>

   #import <Foundation/Foundation.h>

了解更多信息:Please refer this