嗨,我正在尝试在我的 iDevice 上收到推送通知时播放默认的推送声音我使用此代码在
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo` Method
NSDictionary *test =(NSDictionary *)[userInfo objectForKey:@"aps"];
NSString *alertString =(NSString *) [test objectForKey:@"alert"];
NSLog(@"String recieved: %@",alertString);
if (state == UIApplicationStateActive) {
UIAlertView *alertmessage=[[UIAlertView alloc]initWithTitle:@"iEverything Tech"
message:alertString delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertmessage show];
AudioServicesPlaySystemSound(1002);
}
if (state == UIApplicationStateInactive) {
AudioServicesPlaySystemSound(1002);
}
if (state == UIApplicationStateBackground) {
AudioServicesPlaySystemSound(1002);
}
我的第二个问题是如何在 AlertView 中显示 Pushed 消息?
谢谢您的回答!
而且我不能使用像 Parse 这样的推送提供程序,因为我们有自己的服务器,我们需要自动推送