Iphone iOS:是否可以检测音乐库中是否存在曲目?
我正在为一个乐队开发一个应用程序,如果他们的专辑或单曲在用户的音乐库中,他们希望解锁某些功能Iphone iOS:是否可以检测音乐库中是否存在曲目?,iphone,ios,itunes,Iphone,Ios,Itunes,我正在为一个乐队开发一个应用程序,如果他们的专辑或单曲在用户的音乐库中,他们希望解锁某些功能 是否可以扫描库中的特定标题?(可能还可以检查持续时间?两者都可以,请查看,特别是以编程方式查询媒体存储和项目元数据的秒数(持续时间)。这里是一个有效的搜索。这将检查与标题和艺术家姓名匹配的曲目 MPMediaPropertyPredicate *titlePredicate = [MPMediaPropertyPredicate predicateWithValue:@"Sleep The Clock
是否可以扫描库中的特定标题?(可能还可以检查持续时间?两者都可以,请查看,特别是以编程方式查询媒体存储和项目元数据的秒数(持续时间)。这里是一个有效的搜索。这将检查与标题和艺术家姓名匹配的曲目
MPMediaPropertyPredicate *titlePredicate = [MPMediaPropertyPredicate predicateWithValue:@"Sleep The Clock Around" forProperty:MPMediaItemPropertyTitle comparisonType:MPMediaPredicateComparisonEqualTo];
MPMediaPropertyPredicate *artistPredicate = [MPMediaPropertyPredicate predicateWithValue:@"Belle & Sebastian" forProperty:MPMediaItemPropertyArtist comparisonType:MPMediaPredicateComparisonEqualTo];
MPMediaQuery *trackSearch = [[MPMediaQuery alloc] initWithFilterPredicates:[NSSet setWithObjects:titlePredicate,artistPredicate, nil]];
if(trackSearch.items.count > 0) NSLog(@"we found the track!");
你可能想看看这些歌曲是否合法,Tooye想的标题和持续时间是匹配的。这仍然可以得到周围,但它需要为用户付出很多努力。。。