我遇到推送通知问题。在我的App代表中,我有:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary*)userInfo {
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive)
{
NSString *cancelTitle = @"Close";
NSString *showTitle = @"Show";
NSString *message = [[userInfo objectForKey:@"aps"] objectForKey:@"alert"];
UIAlertView *alertView [[[UIAlertView alloc] initWithTitle:@"Alert"
message:message
delegate:self
cancelButtonTitle:cancelTitle
otherButtonTitles:showTitle, nil] ];
[alertView show];
}
我从服务器发送的json代码是:
// Create the payload body
$body['aps'] = array(
'badge' => 1,
'alert' => $message,
'sound' => 'sms-received1.caf '
);
任何人都可以看到我收到此错误的原因:数组大小为非整数类型(UIAvertView)
非常感谢任何帮助。
干杯,
DCJ