Tuesday, December 3, 2013

iPhone alarm problem?

Why do I use UIlocalNotification alarm is no voice?
Paste code:
 
- (Void) viewDidLoad
{
[Super viewDidLoad];

/ / Send notification
UILocalNotification * notification = [[UILocalNotification alloc] init];
if (notification! = nil) {
NSDate * now = [NSDate new];
notification.fireDate = [now dateByAddingTimeInterval: 10] notice
;/ / 10 secondsnotification.repeatInterval = kCFCalendarUnitWeekday ;/ / cycle times, once a week
kCFCalendarUnitWeekdaynotification.timeZone = [NSTimeZone defaultTimeZone];
notification.applicationIconBadgeNumber = 1; / / use red numbers
notification.soundName = UILocalNotificationDefaultSoundName ;/ / sound, can be replaced alarm.soundName = @ "myMusic.caf"
/ / Remove the following two lines will not pop-up boxes
notification.alertBody = @ "notification content" ;/ / message pop-up boxes
notification.alertAction = @ "Open"; / / balloon button
/ / Notification.hasAction = NO; / / whether to display additional buttons disappear when no alertAction

/ / NSDictionary * infoDict = [NSDictionary dictionaryWithObject: @ "someValue" forKey: @ "someKey"];
/ / Notification.userInfo = infoDict; / / add additional information

[[UIApplication sharedApplication] scheduleLocalNotification: notification];
}
[Notification release];
}


Is a new project, in viewDidLoad add this to write code, but there are tips, no sound, this is why?
Reply:
Do not see the problem with a code if you debug on a real machine? Check the environment.
Reply:
Learn, support! !
Reply:
Le test, the same can not, how I am so hard to force it
Reply:
Simulator no sound, there is a real machine sounds.

There is no sound, you can check the option settings in the notification, it can turn off the notification sound.
Reply:
There is a problem is that you open the voice?
Reply:
. . . This is not a problem

No comments:

Post a Comment