Apns-alert customization

情到浓时终转凉″ 提交于 2019-12-08 08:03:38

问题


I have successfully used APNS in iphone app and still have a problem the alert customization.Below is my question:

1 I can't custom the Alert view,like title and button title.I custom the alert like:


- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    NSDictionary *apsDic = [userInfo valueForKey:@"aps"];
    NSString *alertStr = [apsDic valueForKey:@"alert"];
    NSNumber *badgeNum = [apsDic valueForKey:@"badge"];
    NSString *soundStr = [apsDic valueForKey:@"sound"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[arr objectAtIndex:1]
                                                        message:msg
                                                       delegate:nil 
                                              cancelButtonTitle:@"OK" 
                                              otherButtonTitles:@"view",nil];
        [alert show];
        [alert release];
}

In my App, the title of the alert is my app's title;and the button titles are "Close" and "View".

2 when I click the "View", is shows the launch view of my app and then it crashes.Why?

So if the alert is provided by the system which can't be customized, the view action is also under control of system. It seems there's contradiction between 1 and 2.

Any help is appreciated! thanks


回答1:


I find: if your app does not start, the apns-alert is provided by the iOS which you can't customize.



来源:https://stackoverflow.com/questions/6225161/apns-alert-customization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!