开发者

How do i save MPMediaItemCollection to NSUSerDefaults?

开发者 https://www.devze.com 2023-02-09 03:15 出处:网络
Anybody know how to do this? The standard method will not work. I want the user to p开发者_开发技巧ick a song, and then have it save for the next time they load the app, but i can\'t seem to get it in

Anybody know how to do this? The standard method will not work. I want the user to p开发者_开发技巧ick a song, and then have it save for the next time they load the app, but i can't seem to get it into NSUserDefaults.


You need to iterate the collection to get the MPMediaItems. MPMediaItem inherits from MPMediaEntity, which has a -valueForProperty: method. If you pass that method the MPMediaItemPropertyPersistentID constant, you'll get back an NSNumber that uniquely identifies the item. This is a value that's persistable across launches.

0

精彩评论

暂无评论...
验证码 换一张
取 消