Ios 在SPPlaylist.m中获取CocoaLibSpotify错误
当我试图构建我的项目时,我在第827行上遇到以下错误Ios 在SPPlaylist.m中获取CocoaLibSpotify错误,ios,spotify,cocoalibspotify-2.0,Ios,Spotify,Cocoalibspotify 2.0,当我试图构建我的项目时,我在第827行上遇到以下错误 /PATH\u TO\u PROJECT/Libs/CocoaLibSpotify/Model/SPPlaylist.m:827:25:将Objective-C指针类型“AVAssetTrack*”隐式转换为C指针类型“sp_track*”(也称为“struct sp_track*)需要桥接转换 以下是发生错误的代码: 805 -(void)addItems:(NSArray *)newItems atIndex:(NSUInteger)in
/PATH\u TO\u PROJECT/Libs/CocoaLibSpotify/Model/SPPlaylist.m:827:25:将Objective-C指针类型“AVAssetTrack*”隐式转换为C指针类型“sp_track*”(也称为“struct sp_track*)需要桥接转换
以下是发生错误的代码:
805 -(void)addItems:(NSArray *)newItems atIndex:(NSUInteger)index callback:(SPErrorableOperationCallback)block {
806
807 SPDispatchAsync(^{
808
809 if (newItems.count == 0) {
810 dispatch_async(dispatch_get_main_queue(), ^{
811 if (block) block([NSError spotifyErrorWithCode:SP_ERROR_INVALID_INDATA]);
812 });
813 return;
814 }
815
816 sp_track **tracks = malloc(sizeof(sp_track *) * newItems.count);
817
818 // libSpotify iterates through the array and inserts each track at the given index,
819 // which ends up reversing the expected order. Defeat this by constructing a backwards
820 // array.
821 for (int currentTrack = (int)newItems.count - 1; currentTrack >= 0; currentTrack--) {
822
823 sp_track *track;
824 id item = [newItems objectAtIndex:currentTrack];
825
826 if ([item isKindOfClass:[SPTrack class]])
827 track = [item track];
828 else
829 track = [(SPTrack *)((SPPlaylistItem *)item).item track];
830
831 tracks[currentTrack] = track;
832 }
833 sp_track *const *trackPointer = tracks;
834
835 if (block)
836 [self.addCallbackStack addObject:block];
837
838 sp_error errorCode = sp_playlist_add_tracks(self.playlist, trackPointer, (int)newItems.count, (int)index, self.session.session);
839 free(tracks);
840 tracks = NULL;
841
842 NSError *error = nil;
843 if (errorCode != SP_ERROR_OK)
844 error = [NSError spotifyErrorWithCode:errorCode];
845
846 if (error && block) {
847 [self.addCallbackStack removeObject:block];
848 dispatch_async(dispatch_get_main_queue(), ^{ block(error); });
849 }
850 });
851 }
谢谢你的帮助 错误是不言自明的-您需要进行桥接转换
track = (__bridge sp_track *)[item track];
或
track = [(SPPlaylistItem *)item track];