2010-11-08 90 views
0

我创建了一个iPhone应用程序。使用这个应用程序,我可以录制我的声音并能够播放该录制的文件。但是如果我从库中选择音乐文件,它不会播放。选择音乐不从iPhone音乐库中播放

// sample code that I have used in my application 

self.player = [MPMusicPlayerController applicationMusicPlayer]; 
MPMediaPropertyPredicate *songNamePredicate = [MPMediaPropertyPredicate predicateWithValue: self.songName forProperty: MPMediaItemPropertyTitle]; 
MPMediaQuery *mySongQuery = [[MPMediaQuery alloc] init]; 
[mySongQuery addFilterPredicate: songNamePredicate]; 
[player setQueueWithQuery:mySongQuery]; 
[player play]; 

请帮我解决它。

回答

0

变化

MPMediaPropertyPredicate *songNamePredicate = [MPMediaPropertyPredicate predicateWithValue: self.songName forProperty: MPMediaItemPropertyTitle]; 

MPMediaPropertyPredicate *songNamePredicate = [MPMediaPropertyPredicate predicateWithValue:self.songName forProperty:MPMediaItemPropertyTitle comparisonType:MPMediaPredicateComparisonContains]; 

还什么是查询结果的值