简体   繁体   中英

Fetch mp3 and aac songs from iphone

Can we fetch an array of song data for all the songs from iphone song library which are having media type as mp3 and aac only. I have been searching for this but didn't found anything productive.

There two framework are needed.

-> MPMediaLibrary, MPMediaQuery

And Code is->

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

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM