Reputation: 75
I'trying to fetch some info on a stream with a call to a server that should give me some JSON object (and it happens with Safari) but it seems that both on simulator and android it end up with SSL handshake failed exception. The usual call is normal http which can't be used anymore in iOS, so while in Safari simply changing it to https do the trick, in Codenameone results in SSL handshake failed exception. Furthermore the same trick in a WebBrowser component let me see the web page of the radio without SSL handshake failed.
I'm using ConnectionRequest to fetch JSON data.
Is there a way to avoid that exception without changing the server configuration?
Upvotes: 2
Views: 318
Reputation: 7483
Codenameone works a little bit different from browsers. Browsers can give you security popup which you can choose to ignore but Codenameone won't allow you to just change non-secure http to https.
You can still use normal http with your app and get it to work on iOS by adding this build hint:
ios.plistInject = <key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict><key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>com.myCompany.myPackageName.MyApp</string> </dict> <dict> <key>CFBundleURLSchemes</key> <array> <string>MyApp</string> </array> </dict> </array>
If you already have an ios.plistInject
build hint, just add this value after a comma in front of the existing value.
com.myCompany.myPackageName.MyApp
is your reverse domain name dot your app name.
Upvotes: 1