2014-02-18 101 views
0

庵建立一個本地通知,並且每一件事是偉大的,但沒有聲音,即使我已經設置了完善的name屬性默認通知聲音名稱。 P.S:聲音不適用於模擬器或設備。UILocalNotifications火災無聲音

這是我的代碼..

UILocalNotification *aNotification = [[UILocalNotification alloc] init]; 
       aNotification.timeZone = [NSTimeZone defaultTimeZone]; 
       aNotification.alertBody = _reminderTitle.text; 
       aNotification.alertAction = @"Show me!"; 
       aNotification.soundName = UILocalNotificationDefaultSoundName; 
       aNotification.applicationIconBadgeNumber += 1; 

[[UIApplication sharedApplication] scheduleLocalNotification:aNotification];

所以任何想法? :)

+2

您的設備是靜音嗎? – Coder404

+0

nop,模擬器呢?這 – Abo3atef

+0

可能重複:http://stackoverflow.com/questions/23532706/why-doesnt-my-uilocalnotification-play-any-sound?rq=1 –

回答

1

您的模擬器可能已被靜音。

進入系統偏好設置 - >聲音 - >音效 - >選中「播放用戶界面聲音效果」

+0

你的意思是,我不能聽到我的聲音通知,在模擬器上? 我無法在模擬器上測試它嗎? – Abo3atef

+1

你可以,你需要首先使用我剛纔告訴你的模式取消靜音。 –

+0

這是檢查,但還沒有聲音! – Abo3atef

0

如果通知火災的應用程序運行時,你不會聽到聲音,你需要出的應用程序聽到它。