iPhone HTTP Request failed by real device - ios

I develop iPhone App which use local rails server for development.
Before the problem, the app could connect to rails server through WiFi.
But, recently the app could not connect to rails server sometimes.
This is the problem I met
1. HTTP Request can not reach to rails server because the rails log do not show nothing.
2. iPhone log show HTTP Request failed because time out.
Environment
1. AFNetworking 3.0.4 I use AFHTTPSessionManager for HTTP Request
2. I user real iPhone devices that are iPhone6s plus iOS 9.2.1, iPhone6 iOS 9.2 and iPhone5s iOS 8.2. All device show same problem.
What I do
1. Changed AFNetworking version 2.6.3 to 3.0.4. But ineffective.
2. Reinstall app. First some times OK. But at a minute same problem occurred.
Anyone know the solution?
I have developed the app for a few months, but recently sudden the problem occurred. I do not know at all why this is happened.

for the http request now you need to add those line in your plist <key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

Starting from iOS9 you should provide NSAppTransportSecurity key value in your plist file to use HTTP (not HTTPS):
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33

Related

React Native iOS simulator network images not loading

I have a react native app created. Image assets and react-native-vector-icons are loading correctly. But network images are not loading. Images are being fetched from aws as signed url. Those links are working correctly on android.
Tried this fix - https://github.com/facebook/react-native/issues/29279#issuecomment-658244428
I don't think the patch fix is required https://github.com/facebook/react-native/issues/29279#issuecomment-657284028 as my react-native version is 0.70.1
App Information
"react-native": "0.70.1"
Xcode Version 13.2.1 (13C100)
ok. the URL you shared is http and iOS does not all http request. to allow http request in iOS please add this to info.plist file
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
for more details please see this question and answer

iOS Custom App Salesforce - SSL Error while trying to connect to salesforce on 4G

We have an iOS iPad app which is built using Salesforce Mobile SDK. Last two days we are facing issues while syncing work back to Salesforce. When they try to sync, it shows this error,
"Server Error - Can't connect to server. An SSL error has occured and a secure connection the server cannot be made."
It works absolutely fine when connected to wifi and sync the data. Also there seems to be no problem while using hotspot from a mobile data. Has anyone faced this issue and know what might be causing this issue? Any help would be appreciated. Thanks!
Add below in Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

How can I prevent my app from downgrading from TLSv1.2 on iOS 8?

I am trying to restrict my app from communicating with a server that is running any version of TLS prior to 1.2. From the docs, it appears that I should be able to do this by calling SSLSetProtocolVersionMin, so I have done that:
SSLContextRef context = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);
SSLSetProtocolVersionMax(context, kTLSProtocol12);
SSLSetProtocolVersionMin(context, kTLSProtocol12);
I have verified that the call to SSLSetProtocolVersionMin does not return an error, but I am still able to connect to servers that negotiate down to SSLv3.
SSLSetProtocolVersionMax appears to work correctly, as when I set it to TLSv1.1 and the server to TLSv1.2 only, I cannot connect to the server.
It appears that this works as expected on iOS 9. Does anybody know if this is not supported in iOS 8, or if there are other steps I need to take?
You can configure iOS to only connect to servers meeting a minimum TLS version using Apple's new Application Transport Security in iOS 9.
You can add code like the following to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mydomain.com</key>
<dict>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>1.2<string/>
</dict>
</dict>
</dict>
You can take a look at the WWDC video.
EDIT:
I see you added to your question to state that you need to accomplish this on iOS 8, which does not have ATS. But hopefully this answer will help those using iOS 9 and that need to do this, since the original question did not include this limitation.

iOS 9.1 Images and Videos not displaying in app

I have develop one application in which there are so many photos and videos.
I have develop this app in xcode6.3 and it will work perfectly but now i have installed new xcode7.1 and when i'm trying to run this app in xcode7.1 it will run perfectly but i haven't seen any videos and images of my app.
Is that any chnage that i have to do in my code or is it any other problem
Starting from Xcode7 Apple mandates that all url access should be HTTPS as a part of Apple Transport Security (ATS)
To overcome this you have to add the following item in your app info.plist file
You can bypass this by adding this key to your info.plist of the project
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
for more details about ATS refer NSURLSession/NSURLConnection HTTP load failed on iOS 9
http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

XCode - Swift - App Transport Security has blocked a cleartext HTTP (http://) error

I have been trying to deal with this problem for a while now, and I'm hoping someone has a solution that I haven't yet seen.
I am using XCode 7 and am testing my app on an iPad (ios 9 beta). I have tried adding the code below to every instance of Info.plist and it doesn't work.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
I have tried decreasing the Deployment Target to 8.4. I have tried restarting both my laptop I am developing on and the iPad.
I just don't know what else to do. Thanks.
You may just be adding it in an invalid position, it should be inside the main <dict> tag. Try adding as the first element in the first dictionary like this.

Resources