Objective-C 中的神秘 SQLite 控制台输出

发布于 2024-11-10 04:56:58 字数 3557 浏览 1 评论 0原文

当运行我的程序来查询 iPhone 的 iPod 库时,我在控制台中得到以下输出:

CPSqliteStatementPerform: attempts 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

我已经禁用了输出到控制台的所有内容,因此我并没有遇到错误NSLog。这是怎么回事以及我该如何解决它。我将包括我正在调用的整个类源代码,以及执行该工作的类(很抱歉将其全部发布:

+(NSMutableDictionary *) makeQuery {

MPMediaQuery *query = [[MPMediaQuery alloc] init]; //query iPod library
NSString *facebookIDKey = @"Facebook ID";
NSString *genericFacebookID = @"1234567890";
NSMutableDictionary *organizedSongData = [NSMutableDictionary dictionaryWithObject:genericFacebookID forKey:facebookIDKey];
NSArray *allSongs = [query collections];

//only add those songs which have not
//been played since last login
for (MPMediaItem *recent in allSongs) {
    NSDate *lastPlayed = [recent valueForProperty:MPMediaItemPropertyLastPlayedDate];
    int songCounter = 1;
    BOOL uploadInfo = [[PlayedSinceLastLogin alloc] initWithLastPlayedDateOfSong:lastPlayed];
    if (uploadInfo == YES) {
        //adds songs into
        [organizedSongData addEntriesFromDictionary: [MakeDicForSongInfo initWithMPMediaItem:recent andSongNumber:songCounter]];
        songCounter++;
    }
}

return organizedSongData;
}

这是工作的实际主要内容,在 MakeDicForSongInfo 中完成:

+(NSDictionary *) initWithMPMediaItem:(MPMediaItem *) song andSongNumber: (int)songCount{


//Create & initialize NSStrings for keys
//Create NSArray to hold keys

NSString *songKey = [NSString stringWithFormat: @"%i Song Title", songCount];
NSString *albumKey = [NSString stringWithFormat: @"%i Album", songCount];
NSString *artistKey = [NSString stringWithFormat: @"%i Artist", songCount];
NSString *artistIDKey = [NSString stringWithFormat: @"%i Artist Persistent ID", songCount];
NSString *lastPlayedKey = [NSString stringWithFormat: @"%i Late Played Date", songCount];
NSString *genreKey = [NSString stringWithFormat: @"%i Genre", songCount];
NSString *ratingKey = [NSString stringWithFormat: @"%i User Rating", songCount];
NSString *playCountKey = [NSString stringWithFormat: @"%i Play Count", songCount];

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

return songInfo;
}

它可能是访问所有内容的东西吗?那些吓坏 iPhone 的媒体信息?

When running my program to query the iPod library of my iPhone, I get the following output 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

I have disabled everything that outputs to the console so it isn't as if I am having an error with NSLog. What is going on here and how can I fix it. I'll include the overall class source code that I am calling, along with the class that does the work (sorry for posting it all:

+(NSMutableDictionary *) makeQuery {

MPMediaQuery *query = [[MPMediaQuery alloc] init]; //query iPod library
NSString *facebookIDKey = @"Facebook ID";
NSString *genericFacebookID = @"1234567890";
NSMutableDictionary *organizedSongData = [NSMutableDictionary dictionaryWithObject:genericFacebookID forKey:facebookIDKey];
NSArray *allSongs = [query collections];

//only add those songs which have not
//been played since last login
for (MPMediaItem *recent in allSongs) {
    NSDate *lastPlayed = [recent valueForProperty:MPMediaItemPropertyLastPlayedDate];
    int songCounter = 1;
    BOOL uploadInfo = [[PlayedSinceLastLogin alloc] initWithLastPlayedDateOfSong:lastPlayed];
    if (uploadInfo == YES) {
        //adds songs into
        [organizedSongData addEntriesFromDictionary: [MakeDicForSongInfo initWithMPMediaItem:recent andSongNumber:songCounter]];
        songCounter++;
    }
}

return organizedSongData;
}

Here is the actual brunt of the work, done in the MakeDicForSongInfo:

+(NSDictionary *) initWithMPMediaItem:(MPMediaItem *) song andSongNumber: (int)songCount{


//Create & initialize NSStrings for keys
//Create NSArray to hold keys

NSString *songKey = [NSString stringWithFormat: @"%i Song Title", songCount];
NSString *albumKey = [NSString stringWithFormat: @"%i Album", songCount];
NSString *artistKey = [NSString stringWithFormat: @"%i Artist", songCount];
NSString *artistIDKey = [NSString stringWithFormat: @"%i Artist Persistent ID", songCount];
NSString *lastPlayedKey = [NSString stringWithFormat: @"%i Late Played Date", songCount];
NSString *genreKey = [NSString stringWithFormat: @"%i Genre", songCount];
NSString *ratingKey = [NSString stringWithFormat: @"%i User Rating", songCount];
NSString *playCountKey = [NSString stringWithFormat: @"%i Play Count", songCount];

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

return songInfo;
}

Could it be something in accessing all that Media information that spooks the iPhone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阪姬 2024-11-17 04:56:59

显然,这是 iOS 4.3 中的一个错误,已在 Apple 的开发论坛中解决:

https://devforums。 apple.com/message/428584#428584

Apparently this is a bug in iOS 4.3 and is addressed in this devforum at Apple:

https://devforums.apple.com/message/428584#428584

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文