下载
1、下载Hbuilder IOS版SDK http://ask.dcloud.net.cn/article/103
2、下载极光推送基于Hbuilder开发的DEMO https://github.com/jpush/jpush-hbuilder-demo
集成
打开SDK里面的Hbuilder DEMO
配置 manifest.json ,首先用源码的方式打开工程 /Pandora/ 目录下的 manifest.json ,在"permissions"中添加新的插件名称:
"permissions": { "Push": { "description": "极光推送插件" } }
配置 feature.plist ,在 Xcode 中打开 ../PandoraApi.bundle/ 目录下的 feature.plist ,为插件添加新的 item:
在 JPush_Support/PushConfig.plist 中配置 APP_KEY 、 PRODUCTION(0开发 / 1发布)、IDFA(是否需要通过广告标识符启动 sdk)
打开 xcode,点击工程目录中顶部的 工程,选择(Target -> Build Phases -> Link Binary With Libraries),添加以下框架:
CFNetwork.framework CoreFoundation.framework CoreTelephony.framework SystemConfiguration.framework CoreGraphics.framework Foundation.framework UIKit.framework AdSupport.framework libz.tbd(若存在 libz.dylib 则替换为 libz.tbd)
最后打开appdelete.m文件 在远程注册成功收到devicetoken回调 下面的代码块中 加上这一句代码
[JPUSHService registerDeviceToken:deviceToken];
在appdelete.m (void)applicationWillEnterForeground:(UIApplication *)application 这一代码块改为
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[PDRCore handleSysEvent:PDRCoreSysEventEnterForeGround withObject:nil];
UILocalNotification *clearEpisodeNotification = [[UILocalNotification alloc] init];
clearEpisodeNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:1];
clearEpisodeNotification.timeZone = [NSTimeZone systemTimeZone];
clearEpisodeNotification.applicationIconBadgeNumber = -1;
[[UIApplication sharedApplication] scheduleLocalNotification: clearEpisodeNotification];
[application cancelAllLocalNotifications];
[application setApplicationIconBadgeNumber:0];
}
接下来就能正常收到消息了。