私のアプリは、データベースから別のテキストデータを選択するために使用します。また、毎日ローカル通知を表示する機能があります。私は次のコードを使用していますiPhone:ローカルの通知のためにそれぞれの異なるテキストをアラートで表示することは可能ですか?
:今
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
return;
localNotif.fireDate = [itemDate addTimeInterval:-(minutesBefore*60)];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"Hey"; // Can I select random message for this notification?
localNotif.alertAction = NSLocalizedString(@"View Details", nil);
localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = 1;
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:item.eventName forKey:ToDoItemKey];
localNotif.userInfo = infoDict;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
は、それがローカル通知のために別のテキストデータを表示することは可能ですか?どうやって ?
あなたは、表示したい異なるテキストの例を挙げることができます。 – Leena
@Leena:ランダムな言葉:localNotif.alertBody = @ "Hey";それ以外の場合はlocalNotif.alertBody = @ "Hello";そうでなければlocalNotif.alertBody = @ "OH great"; – Devang
文字列の配列を作成し、文字列をランダムに選択してlocalnotification.alertbody – Leena