Can I get music player data or songs in the iPhone app?

Hi, first of all, I'm new to the iPhone,

I want to access all the songs in my application. Is it possible for all songs to be recorded?

Many thanks. It may be easy for you, but for me it is difficult.

+6
source share
3 answers

You need a Media Player environment:

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

Actual example taken from documents:

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); } 
+13
source

This tutorial can also help you.

+4
source

You need a Media Player environment:

With it, you can use this MPMusicPlayerController class.

You will find it all.

for more information, see How to play music using MPMusicPlayerController?

+2
source

Source: https://habr.com/ru/post/908711/


All Articles