NSURLSession returns data as Null on Watch OS2 using Objective-C

前端 未结 2 481
予麋鹿
予麋鹿 2021-01-20 02:26

This works perfectly on iPhone (Simlulator and Device) but on Watch OS2 i get blank data. What might be the issue with this ?

NSURLSession *session = [NSURLS         


        
相关标签:
2条回答
  • 2021-01-20 02:43

    Sorry found the mistake. Had to add Allows Arbitrary Loads on the WatchKit extension. After adding i got the result.

    0 讨论(0)
  • 2021-01-20 02:56

    [self.table setNumberOfRows:[arrurlimg1 count ]withRowType:@"QuoteTableRow"];

    for (NSInteger i = 0; i < self.table.numberOfRows; i++) {
    
        ICBQuoteTableRow* theRow = [self.table rowControllerAtIndex:i];
    
        NSURLSessionConfiguration  *config =[NSURLSessionConfiguration defaultSessionConfiguration];
        NSURLSession *session =[NSURLSession sessionWithConfiguration:config];
    
        NSURLSessionTask *task = [session dataTaskWithURL:url completionHandler:^(NSData * _Nullable data1, NSURLResponse * _Nullable response, NSError * _Nullable error)
                                  {
                                      for (int i=0; i<arrurlimg1.count; i++)
                                      {
    
                                          UIImage *image =imgData1;
                                          [theRow.myFirstImage setImage:image];
                                          // [theRow.myGroup setBackgroundImage:image];
                                      }
                                  }];
        [task resume];
    
    }
    
    0 讨论(0)
提交回复
热议问题