I’m writing an application wich saves entries in the internal sqlite db with a primary key and makes an LocalNotification with this key as the userInfo.
But if I get the key from the LocalNotification and search for its entry in the db, I find nothing. Then i changed the Interface that i see the key in a Label and have noticed that the key is changing after every application start.
So I try to make another “key”column and saved a
NSInteger *randomNR = (NSInteger*)random()
into it. But this number is also changing everytime! So can I copy the actual number of the random() method and save this to the db?
You’re not making an
NSIntegerfromrandom()correctly.random(3)returns along. You can’t simply cast a long into anNSInteger *and get the value you want.You may be confusing
NSIntegerwith an object.NSIntegers are primitive data types and don’t need to be pointers like Cocoa classes. You probably want to use: