You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi i'm trying to make a query and to get all the metadata from the iPod library. So following the reference:
MPMediaQuery *everything = [[MPMediaQuery alloc] init];
NSLog(@"Logging items from a generic query...");
NSArray *itemsFromGenericQuery = [everything items];
for (MPMediaItem *song in itemsFromGenericQuery) {
NSString *songTitle = [song valueForProperty: MPMediaItemPropertyTitle];
NSLog (@"%@", songTitle);
}
But only if i compile with theos this piece of code crash on '-(id)valueForProperty'. Why? Which file should i include? (Already added the MediaPlayer framework, and included with #import).
The text was updated successfully, but these errors were encountered:
It doesn't crash because of theos. It crashes because of your faulty code.
MPMediaQuery is not meant to be initialized by yourself. You should get an existing query using one of its class methods documented at its class reference. Since you mean to get all songs, I'd go with calling +[MPMediaQuery songsQuery].
Now, why does it crash? [everything items] probably returns an empty or nil array, which you crash when trying to iterate through.
Now, just to end, here's a motto for you: INCLUDING FILES DOES NOT CHANGE YOUR RUNTIME BEHAVIOR, BUT YOUR COMPILING BEHAVIOUR.
If I misunderstood your question and am giving a complete out of context answer, please let me know. :P
Due to the lack of response and this question not being related to theos in any way: Even though this one might have not been completely been solved for the asker, it doesn't belong here anymore.
Hi i'm trying to make a query and to get all the metadata from the iPod library. So following the reference:
But only if i compile with theos this piece of code crash on '-(id)valueForProperty'. Why? Which file should i include? (Already added the MediaPlayer framework, and included with
#import
).The text was updated successfully, but these errors were encountered: