Json error in SAP oData service iOS application - ios

I created sample app using SAP Cloud platform, it also generated Proxy classes with backend url "http://staging.*****.com/OData/sapiOS.svc/". When I running the app it didn't display the details and shows an error:
" JsonError: Expected token start character, found '<'." JsonError.

You can ignore all app transport security restrictions with a single key add these to the Info.plist open as Source Code:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

Related

What should i do if i have an error of fetching api using http?

enter image description here
When i am fetching data from api using http, this error always shows up i guess it is related to xcode
I tried to add this
"<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>"
in info_plist folder also upgraded all libraries

iOS WKWebView doesn't load http web content

WKWebView doesn't load http requests, only https is working. My Url's strings are fetched from an API, so the url's links could be http and https. I did read about security, however the only thing I found was to add the following lines to the Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key> NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
However, in the .plist these keys don't exist. Is there any way to make WKWebView load http web content, and would the app be approved by the App Store?
I'm using Xcode 9.
1: Open your info.plist file from the project
2: add App Transport Security Settings in Information Property List
3: add Allow Arbitrary Loads in App Transport Security Settings
See the attached images
You can ignore all transport security restrictions with the key your provided using the following:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
I assume your example is not working due the space in the key:
<key> NSAllowsArbitraryLoadsInWebContent</key>
Try to use the same value as you did but without the space.

Fetch (or Axios) in react native not working for expo for iOS apps

iOS doesn't allow to navigate to http only url, allowing only https.
There is a solution, which is changing some code inside info.plist file
https://github.com/facebook/react-native/issues/8717
How can I change settings for iOS, as it comes with only .expo folder but nothing else.
Do I need to change server configuration for this at last? :(
As you properly find out, the problem is that iOS do not allow arbitrary calls to non-secure(http only) domains. It was a feature introduced with iOS 9 in order to push developers onto more secured connections.
As per writing of this(mid 2017), there is workaround. You should open
{Your-project}/ios/{Your-project}/Info.plist
and set proper values for the domain you are targeting(docs).
Following example will disable ATS and allow HTTP call to somedomain.com:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
In your situation, I believe you are looking for the Info.plist file in the wrong place. It is not part of the node modules, instead look at the ios path specified above.
Unfortunately Expo doesn't allow you to modify the App Transport Security Settings but may bake in a configuration option. Here's a Github thread.
You can eject from Expo but only do this if you are 100% sure.
This will give you a project very similar to one created by react-native init
This features an ios and android directory, navigating to ios/YourProject/ will reveal Info.plist.
How much of a struggle would it be to install an SSL certificate on your server? It may be more beneficial to do this and you can use a free service like letsencrypt.

Configuring NSAppTransportSecurity in code

I have an app that is used by different companies. The user first needs to log in throughout a webservice with always the same base-url. When he is logged in successfully I get a base-url (with htttps) back from the webservice. But this base-url is different for each company.
Now when I start my app in IOS9 and I log in and try to call the webservices with the different base-url, I get this error:
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9847, NSErrorFailingURLStringKey=https://81.82.219.213:8080/TechAppService/TechAppService.svc//authuser?login=***&password=***
I know that I need to set up the NSAppTransportSecurity dictionary in the info.plist. The problem now is that I don't know how I can set this in code.
Step-1
select info.plist and click Right --> go to Source Code
Step-2
the source code open as Key Format , on that key add the following keys in last
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
you can see like sample output
Step - 3
it automatically added in your plist just like follows
Its because there are few changes in iOS 9 SDK to use network in apps. you need to add following key in info.plist file.
Step 1: Open info.plist file in your project.
Step 2: Add App Transport Security Settings key.
Stpe 3: Add child key Allow Arbitrary Loads and set value to YES.
Thats all for more details read apple documentation.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Paste this into the end of your Info.plist This will allow all connections
Please set it in Info.plist. For more info see in the given image

App Over-The-Air Installation with HTTPS not working

I know that in general installation via HTTPS is working but somehow it doesn't in my Environment.
The itms-service link is HTTP as far as I understood:
itms-services://?action=download-manifest&url=http://' . $_SERVER['SERVER_NAME'] . $downloadLink
The links in the .plist are then HTTPS
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://app.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>https://image_512x512.png</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<string>https://image_57x57.png</string>
</dict>
</array>
But the app won't install. I always get the message "App could not be loaded"
All URL's are reachable with HTTP & HTTPS.
XCode shows the app log
unknown securityd[2331] : CFReadStream domain: 12 error: 8
What am I doing wrong here?
Thx
There's not a huge amount of information about how you've tried to solve this, so rather than actual answers I just have questions. If the answer to any of the questions is 'no' then should point you at the area your problem is in.
Is https://app.ipa the actual URL you're using in the .plist? If so I'd try with the full hostname & path in there.
Does the https site have a proper signed valid certificate that Safari on iOS accepts without any interaction with the user? If not try a proper certificate.
Do you see the .ipa file get downloaded from the server, if you check the server log file?
Have you tried installing the .ipa file using iTunes, does it get accepted?
The problem is that the Certificate Authority needs to be known by the iPad.
If you distribute Apps with HTTPS and the CA Server is your own, you need to install the certificate on the iPad. Otherwise iOS will try to download it.
You can install it sending it via email to your iPad or create a .pem File from the Keychain Access program and host it on your server for installation purposes. Then open it with Safari and iOS will ask you to accept it.
Then the installation works. But beware of using .htaccess as using HTTPS and HTTP together in the installation process seems to trigger the login/password for every request, which are 4 for images, .ipa and .plist, which is really annoying.
[EDIT]
Please keep in mind that you need to refer to the .plist file only with HTTPS since Apple introduced iOS 7.1.
See here: Enterprise app deployment doesn't work on iOS 7.1

Resources