2012-02-26 104 views
2

是否可以創建UILocalNotification播放自定義聲音但不振動手機?用聲音和無振動創建UILocalNotification

編輯:這是我用來創建UILocalNotification的代碼,它的工作原理,但它振動手機。 我不想讓手機振動,但我想播放聲音。

UILocalNotification *notif = [[UILocalNotification alloc] init]; 
notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:seconds]; 
notif.timeZone = [NSTimeZone defaultTimeZone]; 
//notif.alertBody = alertMessage; 
//notif.alertAction = @"Show me"; 
notif.soundName = soundName; 
notif.applicationIconBadgeNumber = 0; 
NSDictionary *userDict = [NSDictionary dictionaryWithObject:soundName forKey:kCurrentSound]; 
notif.userInfo = userDict; 
[[UIApplication sharedApplication] scheduleLocalNotification:notif]; 
[notif release]; 

回答

1

不幸的是,如果您想要聲音,除非用戶進入常規設置並禁用振動,否則無法禁用振動。