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];