Browser Widget in IOS not working

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Batninja
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 55
Joined: Sat Oct 15, 2011 9:43 am

Browser Widget in IOS not working

Post by Batninja » Thu Nov 10, 2016 2:58 pm

Hi

Hope someone can assist me.

I cannot get the browser widget to work in the iPhone simulator, it just shows as a blank white screen.
The stack works fine on my mac displaying the web page and other stacks run fine in the iPhone simulator and the simulator will display a page using the mobile safari browser so I'm not clear what I'm doing wrong.

I used a test stack, added the browser widget, set the url to a working http:// address in the properties and specified the browser widget be included in the application settings.

Any thoughts ideas gratefully accepted. What I'm trying to do is add a local help page for a mobile app I'm working on.

Roger

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Browser Widget in IOS not working

Post by LiveCode_Panos » Thu Nov 10, 2016 3:10 pm

Hi Roger,

Here are some things to check:

1. In case you have selected to manually add any inclusions to the standalone, make sure you add the Browser Widget Inclusion (in "Inclusions" pane in the Standalone Application Settings)
2. If you are using a http URL, iOS will block it for security reasons. To cope with that:
- Use a https URL instead (recommended) OR
- Disable ATS (App Transport Security) in the Standalone Application Settings for iOS (not recommended)

Best regards,
Panos
--

Batninja
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 55
Joined: Sat Oct 15, 2011 9:43 am

Re: Browser Widget in IOS not working

Post by Batninja » Thu Nov 10, 2016 6:33 pm

Thanks Panos

It was the ATS setting that was stopping the browser widget display the site.
Once I disabled it the widget sprung into action.

I expect disabling the ATS is not a good thing so I'll have to author the help pages with standard live code controls rather than just use a web page.

Thanks again.

Roger

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: Browser Widget in IOS not working

Post by peter-b » Mon Nov 14, 2016 12:00 pm

I believe there's a way to enable ATS, but to add specific websites that normal HTTP should be used for to your application's plist. This will allow you to use a browser widget to display your help docs over HTTP, but still leave ATS enabled. This blog has some detailed information: https://ste.vn/2015/06/10/configuring-a ... osx-10-11/
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Browser Widget in IOS not working

Post by trevix » Fri Dec 16, 2016 5:29 pm

I tried to modify the info.plist (LC8,1,2RC3 on OS X) inside the bundle with this, as suggested:

Code: Select all

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>mywebsite.it</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>
but it does not work.
Any suggestions?
Trevix
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Browser Widget in IOS not working

Post by LiveCode_Panos » Fri Dec 16, 2016 10:08 pm

Hi Trevix,

Editing the info.plist *in the ios_standalone.app* bundle will not work. You have to either

1. edit the template plist in LiveCode Indy.app to include those changes and then create your ios standalone.

OR

2. create a info.plist file that has those changes and add it to the "Copy Files" section, and then create the ios standalone

================================
To do option (1):

1. Open a terminal
2. Type:
sudo nano path/to/LC Application Folder/Contents/Tools/Runtime/iOS/Device-10_1/Settings.plist

3. Add those key-value pairs

4. Press Ctrl + O, then Enter and then Ctrl + X to exit

5. Your changes should now be saved. You don't need to add anything in the Copy Files section
=================================
To do option (2):

1. Navigate to LC Application Folder / Contents / Tools / Runtime / iOS / Device-10_1
2. Copy the Settings.plist file, and paste it to your desktop
3. Open Desktop / Settings.plist with e.g. TextWrangler editor (The file should be read-only. Make sure you add write permissions first)
4. Add those key-value pairs into Settings.plist
5. Save
6. Rename Settings.plist to Info.plist
7. LC > Myapp > Standalone App Settings - add the desktop Info.plist file into the Copy Files
8. LC > Myapp > Build Standalone Application
9. *Remove existing Myapp from your iOS device
10. Install new Myapp to your iOS device

Best,
Panos
--

Note: The */Device-10_1/* in the paths I described should be used in case you test on a device, and use Xcode 8.1 to build the standalone.
If you want to test in the simulator, replace */Device-10_1/* with */Simulator-10_1/*

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Browser Widget in IOS not working

Post by trevix » Mon Dec 19, 2016 12:10 pm

The first option seems to be the best (once for all).
But my ignorance on the use of the Terminal is evident:

- I replaced the path with:
sudo nano /Applications/LiveCode Indy 8.1.2 (rc 3).app/Contents/Tools/Runtime/iOS/Device-10_1
but the terminal considers "(" as an unexpected token. Should I rename the LC App?

- In order to verify the above, I tried with another path (just to see what's happening):
sudo nano /Applications/LiveCode 5.5.5.app/Contents/Tools/Runtime/iOS/Device-6_1/Settings.plist
The Terminal dose not show the content as expected, only "File: /Applications/Livecode" on the top of the window and "[ New File ]" in the bottom. Is this correct?

- I also don't understand why is it different to use the terminal or to copy the settings.plist to the desktop, open it with BBedit, modify it,save it and copy it back.

Thanks
Trevix
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Browser Widget in IOS not working

Post by LiveCode_Panos » Mon Dec 19, 2016 1:05 pm

Hi Trevix,

You are having those problems in the Terminal because the path contains spaces. So when the first space is met, the Terminal thinks this is the end of the command, and interprets everything after the space as arguments to this command. You have to escape the spaces, so you should type something like:

Code: Select all

sudo nano /Applications/LiveCode\ Indy\ 8.1.2\ \(rc\ 3\).app/Contents/Tools/Runtime/iOS/Device-10_1/Settings.plist
- I also don't understand why is it different to use the terminal or to copy the settings.plist to the desktop, open it with BBedit, modify it,save it and copy it back.
I have not used BBEdit and I am not sure how flexible it is with changing permissions. But what you suggest will probably work. I just personally find it easier to do that via Terminal, since it is a one-step process.

Best,
Panos
--

dbeugeling
Posts: 12
Joined: Thu Feb 12, 2015 12:22 pm

Re: Browser Widget in IOS not working

Post by dbeugeling » Wed Mar 15, 2017 10:37 pm

Please see my post in Re: Loading Local Files with Browser Widget on Android

dbeugeling
Attachments
Browsertest2.livecode.zip
(1.24 KiB) Downloaded 294 times

Post Reply

Return to “iOS Deployment”