App Transport Security blocking with "Allow Arbitrary Loads = YES" - ios

I'm trying to access my Python CGI script running on an instance in Amazon EC2 though a POST request but even though I have changed my Info.plist file to allow arbitrary loads it shows:
Here's where I make the POST request:
let manager = AFHTTPRequestOperationManager()
let URL = "http://ec2-XX-XX.compute-1.amazonaws.com/cgi-bin/hellopy2.py"
let params = ["userToken": "XXXXXXXXXXX"]
manager.POST(URL, parameters: params, success: { (operation, responseObject) -> Void in
Here is my info.plist file:

Make sure you have the right Info.plist file
First, make sure that the Info.plist that you put those settings in is the one your project is using. You can verify this by going into your project settings and searching for Info.plist. Make sure that the Info.plist file where you set those values is the one for the build target you are building.
You can also verify after the fact if you build your project to an IPA. Unzip the IPA, and in the folder that is unzipped, you should see an Info.plist file. Verify that your ATS settings are in that file to make sure the running app should use those exceptions.
Get the settings correct / consistent
Once you've verified this, you should clean up your settings. You use the global flag for allowing any insecure traffic. That will work for now, but after the end of 2016, you won't be able to submit to the store without providing Apple a justification and facing possible rejection. I would recommend not using it at this point, unless this is an app that won't be distributed through the app store (e.g. an enterprise app). If you do choose to use this flag, remove the exception domains, as they are unneeded (you are basically saying all domains are exceptions and allow http).
If you want to do it correctly, by only allowing insecure connections to amazonaws, your settings should simply look like this:
If you have those settings, and your Info.plist configuration is correct, you should be able to access any amazonaws.com subdomains without https.

"http://" is not part of the domain name.
Remove the "http://" from the domain name in your Info.plist file.
*You don't need to set the global "Allow Arbitrary Loads" key to "Yes" for this to work.

Related

How to add url deeplink in iOS Swift

How can I add deeplink (url like https://www.example.com) in iOS using swift.
The scheme in plist is not working if I enter url in it.
You can check the screenshot of plist attached.
You are attempting to register your app for the URI scheme https which Apple has already reserved for Safari, therefore you will not be able to use it.
Option 1: Custom URI Scheme
You must come up with a custom URI scheme like customURI://www.domain.com
Downside: If a user clicks on this link without the app installed. iOS will show that user and error.
Option 2:Universal Links
Apple launched Universal Links in iOS 9 to enable developers to associate their http link with their app. This requires you to host your own AASA file on your domain so that your domain becomes associated with your app ID.
Option 3: Branch.io
Branch will actually bundle up Universal Links and URI schemes and use them appropriately when necessary. They also perform deferred deep linking. They'll host your AASA file for you, but your app domain will have to be either https://*.app.link or some dedicated subdomain of a domain that you own.
only to be precise:
If you need more docs about in Apple docs, use the CORRECT name for the technology.
If You use url starting with a schema different from http (for example fb:// for FB) is not a LINK, is a "custom" url.
Anyway use: custom url and see at:
https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html

iOS Universal Link With PRIVATE domain

I am trying setup iOS universal link with a private server. I put my apple-app-site-association on my private_domain/apple-app-site-association .
However, iOS can not download the Apple-app-site-association from server even testing device in the same network as my private domain . I am wondering if it possible to set up Universal Link with Private Domain ? Thanks
This is not possible, no. You'll see in the device logs, if you watch during app installation, that setup of universal links is failing because the domain cannot be reached.
You can work around this by creating a public domain (just use an Azure site or something similar). The apple-app-site-association must exist as a static file. Note that if you are using Azure you'll need to add a file handler for the empty file extension and another file handler for Android's json file extension if you're doing Android as well.
If you want the links to work for web as well then just have the paths redirect to your internal (private) domain.

plist not allow add URL types key

Allows me to add URL types and everything I need, but when I close the plist and open it again, URL types are gone.
I need to add this, so I can open the app from an iMessages extension.
I'm following this post
When my second app is ==> parent and firstApp is my iMessageExt.
But I do not understand why this happens to me with the url types, I do not know if there is any kind of restriction that when I delete them delete them immediately
EDIT:
My .plist

Locate a directory listing of an iOS app

I'm looking for a way to uncover directory paths in an iOS app, for the purposes of deep linking.
Right now, I know that I can unpack an app's info.plist file and look for the "CFBundleURLScheme." This parameter usually looks like this:
CFBundleURLTypes = (
{ CFBundleURLName = "BUNDLEID";
CFBundleURLSchemes = ( "scheme", "fb1234567891011" );
},
);
From here, I can construct a basic URL scheme to launch the app to the home page, by appending "://" to the end of one of the "CFBundleURLSchemes."
If I enter scheme://
into Safari's URL bar and hit enter, then the app will launch on my iPhone to the app's homepage.
However, there is another deep link I know works - scheme://upgrade/pro- This links to a specific in-app directory, and when launched in Safari, opens the app directly to the upgrade page.
I want to be able to find a list of in-app directories that I can append to the basic URL scheme to be able to link to actual in-app pages.
Is there a file somewhere in an app's bundle or Payload folder that has a list of defined directory paths?
I hope that made sense, thanks in advance for any guidance!
No. The URL goes to an entry-point in the app that is parsed by code. Each app can do it how it wants. It could just be a bunch of if/else statements.
Best bet is to ask the developer -- if they made these entry-points, they probably want people to know about them.

Custom URL Scheme Parameters

When defining the custom URL scheme for my app there are 3 keys that I need information about:
CFBundleTypeRole a.k.a Document Role
CFBundleURLName a.k.a URL identifier
CFBundleURLSchemes a.k.a. URL Schemes
I can see, if I just define CFBundleURLSchemes to be myapp the app is launching fine with an URL as myapp://.
Questions are:
Is the URL identifier there only to make my scheme unique? How does
it do that? If I have same scheme myapp defined in 2 apps, and I call myapp://
can I specify which one I want to call by calling myapp://<URL Identifier>?
Edit: What does this URL Identifier actually do? Does it only give a name to url? How it is used?
The Role defines the level of permission which is
None, Viewer or Editor, I am not sure what level of permission my
app has on the launched app as I have not defined anything. I would
like to know what is the default permission when the
CFBundleTypeRole is not defined.
to 1:
A protocol is not guaranteed to be unique. There is no parameter you can define that will open app1 or app2. If two apps use the same scheme it is undefined what happens
to 2:
the role is irrelevant for the most part BUT mandatory:
editor = launched because they can R/W files identified by the same
viewer = can only read and display
Ad 1)
According to Apple documentation they don't give much info about the identifier and why it is needed or where it is used. They only say that it should be unique.
Also if more than one app specify the same url scheme, then the outcome is unpredictable.
See URL identifier and URL scheme
Ad 2)
The Role flag isn't used by iOS.
See In Xcode, under Info tab, what's Role for in URL Types section?

Resources