can't get image from URL? (NSURLErrorDomain error -1100)
You are providing a wrong domain name.
Solution
Delete all the plist settings you have added manually, add this 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
Code to 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
NSURLConnection error 1100 while running ionic app on iOS
Had the same issue and after quite a bit struggle and R&D this is what worked for me.
Seems like relative path is taken by IOS so in your src -> index.html please change this
base href="/"
to
base href="./" (note dot at the beginning of the /)
this will load all the relevant js files (cordova.js, polyfill.js etc.)
the 1100 errors are files not being found due to absolute path.
NSURLErrorDomain error codes description
The NSURLErrorDomain
error codes are listed here https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes
However, 400 is just the http status code (http://www.w3.org/Protocols/HTTP/HTRESP.html) being returned which means you've got something wrong with your request.
Undocumented NSURLErrorDomain error codes (-1001, -1003 and -1004) using StoreKit
All error codes are on "CFNetwork Errors Codes References" on the documentation (link)
A small extraction for CFURL and CFURLConnection Errors:
kCFURLErrorUnknown = -998,
kCFURLErrorCancelled = -999,
kCFURLErrorBadURL = -1000,
kCFURLErrorTimedOut = -1001,
kCFURLErrorUnsupportedURL = -1002,
kCFURLErrorCannotFindHost = -1003,
kCFURLErrorCannotConnectToHost = -1004,
kCFURLErrorNetworkConnectionLost = -1005,
kCFURLErrorDNSLookupFailed = -1006,
kCFURLErrorHTTPTooManyRedirects = -1007,
kCFURLErrorResourceUnavailable = -1008,
kCFURLErrorNotConnectedToInternet = -1009,
kCFURLErrorRedirectToNonExistentLocation = -1010,
kCFURLErrorBadServerResponse = -1011,
kCFURLErrorUserCancelledAuthentication = -1012,
kCFURLErrorUserAuthenticationRequired = -1013,
kCFURLErrorZeroByteResource = -1014,
kCFURLErrorCannotDecodeRawData = -1015,
kCFURLErrorCannotDecodeContentData = -1016,
kCFURLErrorCannotParseResponse = -1017,
kCFURLErrorInternationalRoamingOff = -1018,
kCFURLErrorCallIsActive = -1019,
kCFURLErrorDataNotAllowed = -1020,
kCFURLErrorRequestBodyStreamExhausted = -1021,
kCFURLErrorFileDoesNotExist = -1100,
kCFURLErrorFileIsDirectory = -1101,
kCFURLErrorNoPermissionsToReadFile = -1102,
kCFURLErrorDataLengthExceedsMaximum = -1103,
Captured Video URL not Found
The best way to do is:
let outputFileURL = NSURL(fileURLWithPath: NSTemporaryDirectory()).URLByAppendingPathComponent("output.mov")
Related Topics
Alamofire Type 'Parameterencoding' Has No Member 'Url' Swift 3
Swift 2 to 3 Migration Dispatch_Get_Global_Queue
Cannot Invoke 'Filter' with an Argument List of Type '((_) -> _)'
How Do Generators Whose Element Is Optional Know When They'Ve Reached the End
Store Encodables in a Swift Dictionary
Extending View with Extra Function Without Using Anyview
Swift: How to Reload Row Height in Uitableviewcell Without Reloading Data
Swift (iOS 8 Sdk) Convert Unmanaged<Abmultivalueref> to Abmultivalueref
Custom UI Tableviewcell Selected Backgroundcolor Swift
Can't Form Range with End < Start Check Range Before Doing for Loop
Nsdatecomponents Weekofyear Returns Wrong Date
Define a Swift Protocol Which Requires a Specific Type of Sequence
Any Way to Chain == and || Operands
Swift - Get File Path of Currently Opened Document in Another Application
How to Share Data Between Tab View Controllers