日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

友盟消息推送服务器demo,友盟消息推送总结

發布時間:2025/3/12 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 友盟消息推送服务器demo,友盟消息推送总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

分享的文章連接

1? http://blog.csdn.net/shenjie12345678/article/details/41120637

2;http://dev.umeng.com/push/ios/integration

重點解析:

1:如何獲得友盟推送的AppKey?

1.1登陸到友盟的消息推送界面——>添加應用,出現如下界面

其中開發證書是指:在鑰匙串中導出的Development的證書

生產證書是指:在鑰匙串中導出的Production生產的證書

2:下載消息推送的SDK

3: 代碼? 在AppDelegate.h添加

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[self pushNotification:launchOptions];

return YES;

}

#pragma mark====消息推送配置

-(void)pushNotification:(NSDictionary*)launchOptions{

[UMessage startWithAppkey:@"5578f54967e58e03ad008619" launchOptions:launchOptions];

//#define IS_iOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES : NO)

if(IS_iOS8)

{

//register remoteNotification types (iOS 8.0及其以上版本)

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 (iOS 8.0以下)

[UMessage registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge

|UIRemoteNotificationTypeSound

|UIRemoteNotificationTypeAlert];

}

//是否開啟消息推送

[UMessage setLogEnabled:YES];

}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

{

[UMessage registerDeviceToken:deviceToken];

}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{

NSLog(@"userInfo == %@",userInfo);

NSString *message = [[userInfo objectForKey:@"aps"]objectForKey:@"alert"];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];

[alert show];

}

總結

以上是生活随笔為你收集整理的友盟消息推送服务器demo,友盟消息推送总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。