Mi riferisco a Previous Post per l'archiviazione di NSURL della libreria iPod in NSUserDefault. Ma non è memorizzato in NSUserDefault dopo che l'applicazione è stata chiusa.NSUrl non è archiviato come absolutestring in NSUserDefault
Sto utilizzando altri NSStrings per archiviare in NSUserDefaults che è perfettamente eseguito, ma quando memorizzo NSUrl come stringa assoluta .. non memorizza il valore.
Quale potrebbe essere il motivo ??
EDIT
Seguendo codice che sto usando per salvare NSUserDefault Valore:
currentItem = [collection.items objectAtIndex:songCount];
songURL = [currentItem valueForProperty:MPMediaItemPropertyAssetURL];
[[NSUserDefaults standardUserDefaults] setObject:[currentItem valueForProperty:MPMediaItemPropertyTitle] forKey:@"songTitle"];
[[NSUserDefaults standardUserDefaults] setObject:[songURL absoluteString] forKey:@"songURL"];
avPlayer = [[AVPlayer alloc] initWithURL:songURL];
NSLog(@"songTitle: %@ songURL : %@",[[NSUserDefaults standardUserDefaults]objectForKey:@"songTitle"], songURL);
seguito errore viene quando provo a salvare il NSURL:
2011-09-13 18:47:23.258 Tabata Timer[933:707] songURL : ipod-library://item/item.mp3?id=-3715406019015217536
2011-09-13 18:47:23.258 Tabata Timer[933:707] *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value 'ipod-library://item/item.mp3?id=-3715406019015217536' of class 'NSURL'.
2011-09-13 18:47:23.260 Tabata Timer[933:707] songTitle : Ghajini
2011-09-13 18:47:24.860 Tabata Timer[933:707] *** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value 'ipod-library://item/item.mp3?id=-3715406019015217536' of class 'NSURL'.
2011-09-13 18:47:24.963 Tabata Timer[933:707] songURL : ipod-library://item/item.mp3?id=-3715406019015217536
warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.5 (8L1)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
Potremmo vedere un paio di righe di codice in cui memorizzare l'url? Inoltre, quando dici che non memorizza il valore, presumo che la particolare stringa memorizzata sia semplicemente nulla? Eventuali avvisi sul tuo codice? – Madhu
ho aggiunto il codice ... – DShah