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]);
}