urlProgress seems not work SOLVED

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

urlProgress seems not work SOLVED

Post by jmburnod » Sat Feb 04, 2017 10:47 pm

Hi All,I use urlProgress while a download an https .zip file
It seems urlProgress doesn't work (LC. 8.1.3, iOS 10.2.1) although download is done.
Is there someone get the same result ?
Best regards
Jean-Marc
Last edited by jmburnod on Tue Feb 07, 2017 11:07 am, edited 1 time in total.

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

Re: urlProgress seems not work

Post by LiveCode_Panos » Sun Feb 05, 2017 7:01 pm

Hi Jean-Marc,

I guess you have included the "Internet" library in the standalone, is that correct?

If this is the case, then the "libUrl" library is used for networking on mobile platforms. The "urlProgress" is not supported by "libUrl". The "urlProgress" is implemented in the engine.

So you have two options:

1. Do not add "Internet" inclusion. This will result in the engine behavior to be used, so you can use "urlProgress"

OR

2. Add "Internet" inclusion. This includes "libUrl" in the standalone, which overrides the default engine behaviour. You cannot use "urlProgress", but you can use "libURLSetStatusCallback" instead.

Best,
Panos
--

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: urlProgress seems not work

Post by jmburnod » Mon Feb 06, 2017 12:01 am

Hi Panos,
Thanks for your quick reply
I guess you have included the "Internet" library in the standalone, is that correct?
Yes Sir

I use urlProgress for ios and libUrlSetStatusCallback for OS X and Windows (only one file for all platforms).
That worked fine with LC 7.06.
Is there a change about this ?
Best
Jean-Marc

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

Re: urlProgress seems not work

Post by LiveCode_Panos » Mon Feb 06, 2017 11:08 am

Hi Jean-Marc,

Ok, I think I know what happens:

1. Including "Internet" loads "libURL" in the standalone. This means that "libUrlSetStatusCallback" will work, but "urlStatus" will not.
2. Not including "Internet" will make the standalone to use the engine built-in networking support for mobile, so "urlStatus" will work for iOS. However, desktop standalones (OS X and Windows) will not have networking support at all, so "libUrlSetStatusCallback" will not work on them.
That worked fine with LC 7.06.
Is there a change about this ?
Yes, the change is that in LC 8.1.x you can build standalones *for both Desktop and Mobile platforms" in one go. This was not possible in LC 7.0.6. In LC 7.0.6 you had to first build for Desktop platforms, and then for Mobile.

So I think the workaround in LC 8.1.x is to do the same, i.e.

- Build a standalone for iOS with *no* Internet inclusion checked.
- Build a standalone for OS X and Windows with Internet inclusion checked.

Best regards,
Panos
--

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: urlProgress seems not work

Post by jmburnod » Mon Feb 06, 2017 1:13 pm

Hi Panos,
Thanks again
I tried without internet inclusion but i use a put url to check the connection

Code: Select all

 put url "http://www.alternatic.ch/jmb/ecrireenpictos/MiseJourHistoriqueEEP.txt" into tCurVersion
 return (the result = empty) 
Without internet inclusion, it return false of course
I taked it off and download works.
I was surprised that libURLDownloadToFile works without internet inclusion.
Remains one question:
Which is the best way to check internet connection without internet inclusion ?
All the best
Jean-Marc

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

Re: urlProgress seems not work

Post by LiveCode_Panos » Mon Feb 06, 2017 3:22 pm

Hi Jean-Marc,

The

Code: Select all

put url ..
does work without "Internet" inclusion, since it uses the engine implementation of "put url". If this code returned false to you, it might be because of something else.
I was surprised that libURLDownloadToFile works without internet inclusion.
Yes, this happens because

Code: Select all

libURLDownloadToFile
is implemented in the mobile engine, too.

BTW, if you are using Indy or Business, I suggest you do the same action with "Internet" and "tsNet", i.e.

- If you uncheck "Internet", then uncheck tsNet as well.
- If you check "Internet", then check tsNet as well.
Which is the best way to check internet connection without internet inclusion ?
I would say the

Code: Select all

put url ..
code you use, since it should work without "Internet" inclusion, too.

Another thing that you need to know is that currently there is a bug (http://quality.livecode.com/show_bug.cgi?id=18833) where deploying to iOS simulator (and probably device, too) unloads the tsNet library. So I suggest you type in the msg box

Code: Select all

start using stack tsNetLibURL
each time after deploying to iOS simulator. Again, this applies only if you are using Indy or Business.

Best,
Panos
--

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: urlProgress seems not work

Post by jmburnod » Mon Feb 06, 2017 7:36 pm

Hi Panos,
I tested with Internet unchecked and tSnet unchecked

Code: Select all

on mouseUp
   put url "http://www.alternatic.ch/jmb/ecrireenpictos/MiseJourHistoriqueEEP.txt" into tCurVersion
   if the result = empty then
      put "result = empty" into t
   else
      put the result  into t
   end if
   answer t
end mouseUp
I get this result:
• IDE,"result = empty"
• iOS, result = "The ressource could not be loaded because the app Transport security policy requires the use of a secure connection"

I understand this happens because we recently have changed our site to https instead http

I tried also with https://www.alternatic... with this result
• IDE, tsneterr: (60) SSL certificate problem: Invalid certificate chain
• iOS, to do

Best again
Jean-Marc

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: urlProgress seems not work

Post by dave.kilroy » Mon Feb 06, 2017 8:28 pm

Hi Jean-Marc

I just tried visiting http://www.alternatic.ch and my browser threw up this warning:
Screenshot 2017-02-06 19.23.21.png
So it may be that your certificate (or some related setting on your server) is indeed wonky. My understanding is that ATS won't just accept a domain if it has a SSL cert, it has to be a cert that passes it's standards!

How about if you test against https://www.google.com?
"...this is not the code you are looking for..."

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: urlProgress seems not work

Post by jmburnod » Mon Feb 06, 2017 9:17 pm

Hi Dave,
Thanks for the hint. I sent it to my partners who manage our site.
I write back once I get news about this
Kind regards
Jean-Marc

AxWald
Posts: 472
Joined: Thu Mar 06, 2014 2:57 pm

Re: urlProgress seems not work

Post by AxWald » Mon Feb 06, 2017 9:27 pm

Hi,

1.) The stuff Panos told about libURL was new to me & highly interesting. Is this documented anywhere? If not, it should.

2.) Firefox gives better error messages (translated by me):
www.alternatic.ch is using an invalid certificate.
The certificate is valid for *.infomaniak.ch only.
3.) To check internet connectivity, ping 8.8.8.8 & evaluate the result.
Or have this tiny php on your server:

Code: Select all

<?PHP
function getUserIP()
{
    $client  = @$_SERVER['HTTP_CLIENT_IP'];
    $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
    $remote  = $_SERVER['REMOTE_ADDR'];

    if(filter_var($client, FILTER_VALIDATE_IP))
    {
        $ip = $client;
    }
    elseif(filter_var($forward, FILTER_VALIDATE_IP))
    {
        $ip = $forward;
    }
    else
    {
        $ip = $remote;
    }
    return $ip;
}
$user_ip = getUserIP();
echo $user_ip; // Output IP address [Ex: 177.87.193.134]
?>
and test its URL (if URL "http://myServer.net/myip.php" is empty then ...)
If it's empty, you have no internet. Else you have your real external IP, as bonus ;-)

Have fun!
Livecode programming until the cat hits the fan ...

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: urlProgress seems not work

Post by jmburnod » Tue Feb 07, 2017 11:03 am

Hi All,
Thanks for help
alternatic's partners have done a new ssl certificate and the test connect seems working without internet and tSnet inclusions as Panos said.
I also tried Dave's suggestion with google url and it works too.
@Axwald. Thanks for the hint. I know nothing yet about php but I will do some experiment.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2542
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: urlProgress seems not work SOLVED

Post by jmburnod » Wed Feb 08, 2017 12:31 pm

Hi All,
Is this documented anywhere?
Yes for LiburlDownLoadTofile at "Cross-platform note:"
but no "Cross-platform note:" for urlProgress.
Best regards
Jean-Marc

Post Reply

Return to “iOS Deployment”