URL to MPMediaItem

后端 未结 2 1820
心在旅途
心在旅途 2021-02-03 12:43

I have a simple question but I can\'t find the right answer. I have a song url saved to my database in a path like this.

aSound.path = [[item valueForProperty: MP         


        
2条回答
  •  情话喂你
    2021-02-03 13:21

    Saving:

        NSNumber* persistentID = 
    [mediaItem valueForProperty:MPMediaItemPropertyPersistentID];
    

    Loading:

                MPMediaPropertyPredicate * predicate = 
                  [MPMediaPropertyPredicate 
                    predicateWithValue:persistentID 
                           forProperty:MPMediaItemPropertyPersistentID];
    

    Another example: NSNumber for MPMediaItemPropertyPersistentID to NSString and back again

    Note song URLs are are unreliable because any DRM song returns a null url

提交回复
热议问题