I'm generating random text with as a local notification, my problem is that notification repeat the same text everyday and wont pick another text from that random text, and that problem is only active on local notifications, it's work well on labels and this is my code.
let myNotification:UILocalNotification = UILocalNotification()
myNotification.category = "text"
myNotification.alertBody = text.randomText()
myNotification.soundName = "sound.wav"
myNotification.fireDate = date
myNotification.repeatInterval = NSCalendarUnit.Day
UIApplication.sharedApplication().scheduleLocalNotification(myNotification)
UPDATE : I use Array of Strings named(textArray) with the following function to generate the random text.
func randomText() -> String {
let unsignedArrayCount = UInt32(textArray.count)
let unsignedRandomNumber = arc4random_uniform(unsignedArrayCount)
let randomNumber = Int(unsignedRandomNumber)
return textArray[randomNumber]
}