嗨,我嘗試播放默認推送聲音在我的iDevice接收推送通知時,我用這個代碼在如何在iPhone接收到推送通知時
-(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中顯示推送的消息?
謝謝你的回答!
我不能使用推送提供商像解析,因爲我們小時自己的服務器,我們需要推動自動
感謝您的Answet,但我喜歡在AlertView中查看消息,而不是在登錄Xcode中使用此功能,但之後應用程序崩潰。檢查我添加的問題。 –
好的,謝謝我解決了你的帖子,坦克的問題!我將代碼添加到我的問題 –