ios - can't get image from URL? (NSURLErrorDomain error -1100) -


i trying load jpeg: https://i.groupme.com/638x640.jpeg.d4f31c747b534baca03d12db5a2b6193

but error the operation couldn’t completed. (nsurlerrordomain error -1100.)

from this post, found error means: kcfurlerrorfiledoesnotexist. strange because there image there.

from this post, seemed issue https protocol, after implemented solution switch http, got error:

app transport security has blocked cleartext http (http://) resource load since insecure. temporary exceptions can configured via app's info.plist file. ... the resource not loaded because app transport security policy requires use of secure connection.

and same error continues popup after making necessary plist changes:

enter image description here

how download image in ios?

update

so found download ok https if use code:

nsdata* thedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:@"https://i.groupme.com/638x640.jpeg.d4f31c747b534baca03d12db5a2b6193"]]; uiimage *image = [uiimage imagewithdata:thedata]; 

but doesn't work if use library: https://github.com/rs/sdwebimage

no 1 else seems have had issues https , library though, think still settings problem on end?

you providing wrong domain name.

solution

delete plist settings have added manually, add in plist----

 <key>nsapptransportsecurity</key>     <dict>         <key>nsexceptiondomains</key>         <dict>             <key>i.groupme.com</key>             <dict>                 <key>nsincludessubdomains</key>                 <true/>                 <key>nsexceptionallowsinsecurehttploads</key>                 <true/>                 <key>nsexceptionrequiresforwardsecrecy</key>                 <true/>                 <key>nsexceptionminimumtlsversion</key>                 <string>tlsv1.2</string>                 <key>nsthirdpartyexceptionallowsinsecurehttploads</key>                 <false/>                 <key>nsthirdpartyexceptionrequiresforwardsecrecy</key>                 <true/>                 <key>nsthirdpartyexceptionminimumtlsversion</key>                 <string>tlsv1.2</string>                 <key>nsrequirescertificatetransparency</key>                 <false/>             </dict>         </dict>     </dict> 

plist screenshot

enter image description here

code download image

 nsurl *url = [[nsurl alloc] initwithstring:@"https://i.groupme.com/638x640.jpeg.d4f31c747b534baca03d12db5a2b6193"];  nsdata *data = [[nsdata alloc] initwithcontentsofurl:url];  uiimage *result = [[uiimage alloc] initwithdata:data]; 

image download success screenshot

enter image description here


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -