ローカルの通知が必要なアプリを開発中です。私は複数のオブジェクトを持つテキストの配列を持っており、私は毎日配列のすべての要素を起動する必要があります。 私はこれに多くの問題に直面しています。たびに、配列から1つの通知だけを起動する必要があります。 これを手伝ってください。iosで毎日ランダムなローカル通知を毎日発射する方法
UILocalNotification * notification = [[UILocalNotification alloc] init];
notification.fireDate = fireDateOfNotification;
notification.timeZone = [NSTimeZone localTimeZone];
NSString *myString = SelectedAffirmationText;
NSArray *myArray = [myString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]];
//NSString *StrForNotification=[myArray objectAtIndex:0];
for(int i=0;i<myArray.count;i++)
{
NSString *StrForNotification=[myArray objectAtIndex:i];
notification.alertBody = [NSString stringWithFormat: @"%@",StrForNotification];
}
notification.alertAction = @"go back";
NSDictionary *userDict = [NSDictionary dictionaryWithObjectsAndKeys:DateSelected, @"Date", TimeSelected, @"Time",SelectedAffirmationText,@"DataAffiramtion", nil];
notification.userInfo = userDict;
notification.repeatInterval= NSDayCalendarUnit;
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
作業中のコードをいくつか追加してください。 – Arun
@Arunはコードを追加しました.goを使って答えを提案します –
このリンクをお試しください。これはあなたに役立つかもしれません[1日あたりのローカル通知を発する](http://stackoverflow.com/questions/13296190/local-notification-everyday-at -700am-not-notifying) – Arun