1

Apple Watch Kit wouldn't fetch image from URL

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        NSLog(@"URL string for image %@",urlStr);
        NSData *imgData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlStr]];
        });

The fetch did work in Watch Simulator, But when I run it with a watch, I get these error as log

2016-12-19 15:21:47.491560 Test app WatchKit App Extension[250:130169] dnssd_clientstub ConnectToServer: connect()-> No of tries: 1 2016-12-19 15:21:48.497360 Test app WatchKit App Extension[250:130169] dnssd_clientstub ConnectToServer: connect()-> No of tries: 2 2016-12-19 15:21:49.499671 Test app WatchKit App Extension[250:130169] dnssd_clientstub ConnectToServer: connect()-> No of tries: 3 2016-12-19 15:21:50.501699 Test app WatchKit App Extension[250:130169] dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:7 Err:-1 Errno:1 Operation not permitted 2016-12-19 15:21:50.502103 Test app WatchKit App Extension[250:130169] [] nw_resolver_create_dns_service_on_queue DNSServiceCreateConnection failed: ServiceNotRunning(-65563)

riyaz
  • 1,093
  • 1
  • 8
  • 21
  • You cannot use the NSDataWithContentsOfURL for image downloading. It will not work anymore in real watch os device. You may use URLSession or other third party library such as Kingfisher. – Kit Jan 14 '17 at 18:53

1 Answers1

3

You cannot use the NSDataWithContentsOfURL for image downloading. It will not work anymore in real watch os device. You may use URLSession or other third party library such as Kingfisher.

Kit
  • 2,370
  • 13
  • 11