您的位置:首页 > 移动开发 > IOS开发

【iOS推送】集成umeng时的遇到的一些问题

2015-04-22 20:14 344 查看
1.获取不到设备的 DeviceToken ,didRegisterForRemoteNotificationsWithDeviceToken 方法不执行

答:-我的错误就是这个配置不对 ,bundleid 和 证书 、描述文件不匹配。(下图是配置好了的)

-对于DeviceToken获取不到的其他问题:-网络不好啦 -证书不对啦 -通知关闭就不说了

2.关于iOS8的问题,下面是umeng sdk 写的

答:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= _IPHONE80_
if(UMSYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
//register remoteNotification types
UIMutableUserNotificationAction *action1 = [[UIMutableUserNotificationAction alloc] init];
action1.identifier = @"action1_identifier";
action1.title=@"Accept";
action1.activationMode = UIUserNotificationActivationModeForeground;//当点击的时候启动程序

UIMutableUserNotificationAction *action2 = [[UIMutableUserNotificationAction alloc] init];  //第二按钮
action2.identifier = @"action2_identifier";
action2.title=@"Reject";
action2.activationMode = UIUserNotificationActivationModeBackground;//当点击的时候不启动程序,在后台处理
action2.authenticationRequired = YES;//需要解锁才能处理,如果action.activationMode = UIUserNotificationActivationModeForeground;则这个属性被忽略;
action2.destructive = YES;

UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategory alloc] init];
categorys.identifier = @"category1";//这组动作的唯一标示
[categorys setActions:@[action1,action2] forContext:(UIUserNotificationActionContextDefault)];

UIUserNotificationSettings *userSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert
categories:[NSSet setWithObject:categorys]];
[UMessage registerRemoteNotificationAndUserNotificationSettings:userSettings];

} else{
//register remoteNotification types
[UMessage registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert];
}
#else

//register remoteNotification types
[UMessage registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge
|UIRemoteNotificationTypeSound
|UIRemoteNotificationTypeAlert];

#endif


3.errorcode:5000 第一次返回是success ,再后来每次都是报5000(device_id错误)

答:这是后台的错。ios如果是没有上线,都是测试模式,后台需要添加"production_mode":"false"



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: