【发布时间】:2012-11-22 13:04:08
【问题描述】:
您好,我正在尝试在我的 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 这样的推送提供程序,因为我们拥有自己的服务器,并且需要自动推送
【问题讨论】:
标签: ios xcode uialertview apple-push-notifications audio