Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

MPMediaQuery "write to read-only" console output

I'm trying to query my iPhone for songs and then create an NSDictionary for those objects, but from the console output I am getting, my device will have none of it. The following shows up in the console:


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


What readonly database am I trying to access? I'm just doing a simple MPMedaQuery and then storing the values of some properties. Here is my code, for reference:


// Override point for customization after application launch.

MPMediaQuery *query = [[MPMediaQueryalloc] init]; //query iPod library


NSString *facebookIDKey = @"Facebook ID";

NSString *genericFacebookID = @"1234567890";

NSMutableDictionary *organizedSongData = [NSMutableDictionary dictionaryWithObject:genericFacebookID forKey:facebookIDKey];

MPMediaPropertyPredicate *getOnlyPassionPit = [MPMediaPropertyPredicatepredicateWithValue:@"Passion Pit"forProperty:MPMediaItemPropertyArtist];

[query addFilterPredicate:getOnlyPassionPit];

NSArray *allSongs = [query items];


//add information for songs


for (MPMediaItem *song in allSongs) {

int songCounter = 1;

//adds song information into NSMutableDictionary

//via MakeDicForSongInfo, then adds one to counter

//[organizedSongData addEntriesFromDictionary: [MakeDicForSongInfo initWithMPMediaItem:recent andSongNumber:songCounter]];

//Create & initialize NSStrings for keys

//Create NSArray to hold keys


NSString *songKey = [NSString stringWithFormat: @"%i Song Title", songCounter];

NSString *albumKey = [NSString stringWithFormat: @"%i Album", songCounter];

NSString *artistKey = [NSString stringWithFormat: @"%i Artist", songCounter];

NSString *artistIDKey = [NSString stringWithFormat: @"%i Artist Persistent ID", songCounter];

NSString *lastPlayedKey = [NSString stringWithFormat: @"%i Late Played Date", songCounter];

NSString *genreKey = [NSString stringWithFormat: @"%i Genre", songCounter];

NSString *ratingKey = [NSString stringWithFormat: @"%i User Rating", songCounter];

NSString *playCountKey = [NSString stringWithFormat: @"%i Play Count", songCounter];


NSArray *propertyKeys = [[NSArray alloc] initWithObjects:songKey, albumKey, artistKey, artistIDKey,

lastPlayedKey, genreKey, ratingKey, playCountKey, nil];


//Create & initialize NSStrings to hold song property information

//Create NSArray to hold the values


NSString *songTitle = [song valueForProperty:MPMediaItemPropertyTitle];

NSString *albumName = [song valueForProperty:MPMediaItemPropertyAlbumTitle];

NSString *artistName = [song valueForProperty:MPMediaItemPropertyArtist];

NSString *artistID = [song valueForProperty:MPMediaItemPropertyArtistPersistentID];

NSString *lastPlayed = [song valueForProperty:MPMediaItemPropertyLastPlayedDate];

NSString *genre = [song valueForProperty:MPMediaItemPropertyGenre];

NSString *userRating = [song valueForProperty:MPMediaItemPropertyRating];

NSString *playCount = [song valueForProperty:MPMediaItemPropertyPlayCount];


NSArray *propertyValues = [[NSArray alloc] initWithObjects:songTitle, albumName, artistName, artistID,

lastPlayed, genre, userRating, playCount, nil];


//Create NSDictionary to store information, initializing it with

//above data, then returning the resulting dictionary


NSDictionary *songInfo = [[NSDictionary alloc] initWithObjects:propertyValues forKeys:propertyKeys];


[organizedSongData addEntriesFromDictionary:songInfo];

[songInfo release];

[propertyKeys release];

[propertyValues release];

songCounter++;

}

iPhone 4, iOS 4.3.2, running XCode 4

Posted on May 29, 2011 7:59 AM

Reply
4 replies

MPMediaQuery "write to read-only" console output

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.