Palsofiphone Palsofiphone - 1 year ago 111
iOS Question

Is it possible to get data or songs of music player in iPhone app?

Hello first of all I am new in iPhone,

I want access all songs in my application. Is this posible to get all songs ?

Thank you very much. May be it's easy for you but for me it's hard.

Answer Source

You need the Media Player framework:

  • MPMediaLibrary, MPMediaQuery, etc.
  • iPod Library Access Programming Guide

Actual example taken from the docs:

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download