十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
目前创新互联已为上千家的企业提供了网站建设、域名、网站空间、成都网站托管、企业网站设计、岳阳网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];
// Override point for customization after application launch.
//注册推送通知
// [[UIApplication sharedApplication]registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
//
if ([[[UIDevicecurrentDevice]systemVersion]floatValue] >= 8.0) {
[[UIApplicationsharedApplication]registerUserNotificationSettings:[UIUserNotificationSettings
settingsForTypes:(UIUserNotificationTypeSound |
UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge)
categories:nil]];
[[UIApplicationsharedApplication]registerForRemoteNotifications];
}
else {
[[UIApplicationsharedApplication]registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert|
UIRemoteNotificationTypeBadge|
UIRemoteNotificationTypeSound];
}
if (launchOptions) {
// UIApplicationLaunchOptionsRemoteNotificationKey 这个key值就是push的信息
NSDictionary *dic = [launchOptionsobjectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
// 为了复用代码,统一到下面这个处理方法中handlePushNotify:
[selfhandlePushNotify:dicfromBuld:_ISPushFromClosed]; //如果程序没有启动,点击推送消息进入程序,需要根据推送消息做一些处理,如:视图切换等。
}
//注册远程推送,成功后的代理方法
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
//苹果服务器返回的token(苹果服务器用来标识手机的唯一编号)
//可以交给后台,然后后台需要给此发送远程推送的时候直接用这个token
NSString *tokenStr = [deviceToken description];
NSLog(@"token:%@",tokenStr);
}
//注册远程推送失败
-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"注册推送失败%@",error);
}
//程序正在运行时,点击推送消息所走的方法
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
//在这里可以根据推送信息做一些操作
[selfhandlePushNotify:userInfofromBuld:_ISPushFromOpen];
}
-(void)handlePushNotify:(NSDictionary *)dic fromBuld:(NSString *)buld
{
// 根据buld判断是哪里传来的值
/*
dic = {
aps = {
alert = "\U627e\U5927\U592b\U63d0\U793a\Uff1ahdf21\U7528\U6237\U7533\U8bf7\U52a0\U5165\U60a8\U7684\U5c0f\U680b\U5708\U5708\U5b50";
sound = default;
target = {
"param_list" = (
{
"param_name" = "circle_id";
"param_value" = 2204;
},
{
"param_name" = "circle_name";
"param_value" = "\U5c0f\U680b\U5708";
},
{
"param_name" = type;
"param_value" = 1;
}
);
topage = "/gooddoc/server/index.php/circle/getCircleMembersNews";
};
};
*/
}