按需资源下载优先级不起作用

时间:2016-11-02 07:36:34

标签: ios on-demand-resources

我有两个ViewController: 第一:

@property (nonatomic, strong) NSBundleResourceRequest *resourceRequest ;
- (void) viewDidAppear:(BOOL)animated {

    [super viewDidAppear:animated];

    NSSet *tags1 = [NSSet setWithObjects: "1","2","3","4","5", nil];
    self.resourceRequest = [[NSBundleResourceRequest alloc] initWithTags:tags1];
    self.resourceRequest.loadingPriority = 0.95;
    [self.resourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:
     ^(BOOL resourcesAvailable)
     {}}];
}

和第二:

@property (nonatomic, strong) NSBundleResourceRequest *resourceRequestCurrent ;
    - (void) viewDidAppear:(BOOL)animated {

        [super viewDidAppear:animated];

        NSSet *tags2 = [NSSet setWithObjects: "5", nil];
        self.resourceRequestCurrent = [[NSBundleResourceRequest alloc] initWithTags:tags2];
        self.resourceRequestCurrent.loadingPriority = NSBundleResourceRequestLoadingPriorityUrgent;
        [self.resourceRequestCurrent conditionallyBeginAccessingResourcesWithCompletionHandler:
         ^(BOOL resourcesAvailable)
         {}}];
    }

我打开第一个View,然后转到第二个,但是我看到在tags1之后下载了PriorityUrgent的tags2。

0 个答案:

没有答案