iPhone sdk, save MPMediaItemCollection?

后端 未结 2 1562
囚心锁ツ
囚心锁ツ 2021-02-06 10:07

I have my application displaying a MPMediaPickerController. I would like to save the MediaItem and start it playing again on startup. I think this is d

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-06 10:44

    This should work:

    MPMediaQuery *query = [MPMediaQuery songsQuery];
    MPMediaPropertyPredicate *predicate = [MPMediaPropertyPredicate predicateWithValue:myPersistentID forProperty:MPMediaItemPropertyPersistentID];
    
    [query addFilterPredicate:predicate];
    NSArray *songs = [query items];
    

提交回复
热议问题