I had a minor issue when loading the library, that I eliminated with a validity check. For some reason, some thing in my library was returning a nil value, so loading the musicList was causing a crash. I added in iPodLibrary.m
Code:
#import "iPodLibrary.h"
#import <MediaPlayer/MediaPlayer.h>
#import <AVFoundation/AVFoundation.h>
@implementation iPodLibrary
+(NSMutableDictionary *)musicList
{
NSMutableDictionary *musicList = [NSMutableDictionary dictionary];
MPMediaQuery *query = [[MPMediaQuery alloc] init];
[query addFilterPredicate:[MPMediaPropertyPredicate predicateWithValue:[NSNumber numberWithInteger:(MPMediaTypeMusic)] forProperty:MPMediaItemPropertyMediaType]];
for (MPMediaItem *item in [query items]) {
if (([item valueForProperty:MPMediaItemPropertyAssetURL] != nil) && ([item valueForProperty:MPMediaItemPropertyTitle] != nil)){
[musicList setObject:[item valueForProperty:MPMediaItemPropertyAssetURL]
forKey:[item valueForProperty:MPMediaItemPropertyTitle]];
}
}
[query release];
return musicList;
}
to protect against this possibility.
Also, it does not appear to affect the running of the program, but the Console logs the following:
Quote:
CPSqliteStatementPerform: attempt to write a readonly database for UPDATE ddd.ext_container SET orig_date_modified = (SELECT date_modified FROM container WHERE pid=container_pid) WHERE orig_date_modified=0
CPSqliteStatementReset: attempt to write a readonly database for UPDATE ddd.ext_container SET orig_date_modified = (SELECT date_modified FROM container WHERE pid=container_pid) WHERE orig_date_modified=0
|
I don't know what it is trying to tell me, and some research shows that others have had the same log in other situations using Core Data, but no real resolutions have been posted in those message boards.
Any ideas?
Bob