MPMediaItem and iTunes Match

前端 未结 4 1507
故里飘歌
故里飘歌 2020-12-23 11:47

I have an app that uses the iPod Library API to access the song database in iOS. With the release of iTunes Match, any song which is not on the device will fail to load. I

4条回答
  •  误落风尘
    2020-12-23 12:49

    MPMediaItem | iCloud or DRM Protected

    The link above shows how you can use a property introduced in iOS 6 to see if an MPMediaItem is in the cloud.

    MPMediaItemPropertyIsCloudItem

    BOOL isCloud = FALSE;
    
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
        NSNumber *isCloudNumber = [mediaItem valueForProperty:MPMediaItemPropertyIsCloudItem];
        isCloud = [isCloudNumber boolValue];
    }
    if (isCloud) {
        DebugLog(@"Cloud Asset URL: %@", assetURL);
    }
    

    That is using a macro to ensure only iOS 6 uses that code which was added with iOS 6. Below is that macro.

    #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
    

    Still you cannot initiate a download as far as I can tell.

提交回复
热议问题