1

I have an app that uses MPMediaQuery to create a list of the music the user has on his iPhone. When generating the list, I save the NSURL of each item so I can read the selected song. If, while running the app, I minimize it, open the iOS music player, start a song, come back to my app and play a song, my app crashes. The error is a bad access error when trying to access the NSURL of the selected song. I checked if it's null, and it is not. I can't call anything on the NSURL, either parameters or methods, it always crashes with EXC_BAD_ACCESS(code=1 address=0xc).

NSError *error = nil;
if(!loadingSongURL_){
    NSLog(@"damn"); //Never gets here
}

//NSLog(loadingSongURL_.absoluteString);

if(![loadingSongURL_ checkResourceIsReachableAndReturnError:&error]){ //Crashes here: EXC_BAD_ACCESS(code=1 address=0xc).
    NSLog(@"%@",[error localizedDescription]);
}
4

1 回答 1

0

I believe that iOS updates all Asset URLs when you access them in the music player, so that when I return to my app, I need to make sure to re-update my list.

于 2013-11-29T15:47:36.083 回答