Iphone 如何每周从我的应用程序发出警报声通知用户?

Iphone 如何每周从我的应用程序发出警报声通知用户?,iphone,ios,objective-c,xcode,cocoa-touch,Iphone,Ios,Objective C,Xcode,Cocoa Touch,此处重复时间间隔列表: 指定日历单位,如日和月 UILocalNotification *localNotification = [[UILocalNotification alloc] init]; [localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:3600]]; [localNotification setAlertAction:@"Launch"]; [localNotification setAlert

此处重复时间间隔列表:

指定日历单位,如日和月

UILocalNotification *localNotification = [[UILocalNotification alloc] init];
[localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:3600]];
[localNotification setAlertAction:@"Launch"];
[localNotification setAlertBody:[alertBodyField text]];
[localNotification setHasAction: YES];
[localNotification setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]+1];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[alertNotification setHidden:NO];
定制声音

localNotification.soundName = UILocalNotificationDefaultSoundName; // Here you can also use custom sound .
localNotification.soundName = UILocalNotificationDefaultSoundName; // Here you can also use custom sound .
localNotification.soundName = @"alarm_sound.wav";// put name of sound file
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
[localNotification setFireDate:[NSDate dateWithTimeIntervalSinceNow:3600]];
[localNotification setAlertAction:@"Launch"];
[localNotification setAlertBody:[alertBodyField text]];
[localNotification setHasAction: YES];

// change
localNotification.repeatInterval = NSWeekCalendarUnit;    // set the repeat interval
localNotification.soundName = UILocalNotificationDefaultSoundName; // set alert sound

[localNotification setApplicationIconBadgeNumber:[[UIApplication sharedApplication] applicationIconBadgeNumber]+1];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[alertNotification setHidden:NO];