PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → iOS Phone threading problem
iOS Phone threading problem
Débuté par John Fligg, 24 mai 2018 11:34 - 4 réponses
Posté le 24 mai 2018 - 11:34
I have a problem but don't need a resolution. I need to find out how to get something meaningful back in a live situation (on the device) as the code is failing and I cannot find out why although I know the line it is failing on.

In short it is failing on HCreateMoveableReplica.

Here is the sequence of events:

Thread 0 runs a LOCAL Procedure in Thread 1. That procedure then calls a GLOBAL procedure run in Thread 0 (it has to do that as a file is created in Thread 0 required by HCreateMoveableReplica run in Thread 1). This is when the code fails.

What is interesting is that exactly the SAME code runs in Windows, Android and iOS Tablet and ONLY fails in iOS Phone 11.1.3

Using any method such as Display, Debug to a File or trapping the event "somewhere", how can I find out exactly why this command is failing? I know it is something to do with threading as running in XCode gives me a sort of hint that a Thread issue has happened. But I need to get a meaningful message from the event using PCSoft terminology.

But the problem is, I believe, that any error trapping fails because of the return to thread 0 where it fails not in thread 1.

I hope that makes some sort of sense but basically because of threading the event is failing but not reporting back.

Thx.
Posté le 24 mai 2018 - 13:18
I believe it is not the code at fault since this works with Windows/Android and iOS Tablet.

Anyway, this is a Login Procedure and every step is displayed on the screen. I do that using:
ExecuteMainThread(RefreshUIFromThread, pValue)

Under the Login button I open Thread 1 from Thread 0 using
ThreadExecute("Validate", threadNormal, ValidateLogin)

After more validation code I then need to synchronize back to the Server using a global procedure:
ExecuteMainThread(SyncLocalToServer, "")

I cannot run SyncLocalToServer in Thread1 as then I DO get a message saying the replication file is missing. So I issue this:

bSyncRes = HCreateMoveableReplica(sSubscriberReplica, sRPLFile, "")

The problem is that HCreateMoveableReplica is failing but I cannot get a precise reason why. I know the failure is because sRPLFile is not available but that is not the case. The file IS there.

So it is something to do with threading not seeing the file despite having been created in the same thread. Running this in XCode that tells me that there is a threading issue in respect of iOS.

So I need to find out the EXACT error message being created by HCreateMoveableReplica which will then indicate if this IS truly a threading issue.

Only then can I determine if this is an iOS bug, a WinMobile bug or version WM21 does not support iOS11.1.3. All PCSoft support tells me is to recompile using the latest version of WM!!!

HTH
Posté le 24 mai 2018 - 14:01
Hi...

I do hope that you are using the appropriate functions to call anything of the main thread from a secondary one, as that is otherwise a BIG no no...

But as you are not showing us ANY code...
Posté le 24 mai 2018 - 15:09
John

ios Dev. is always moving ahead and any old wm versions certainly won't work.
Indeed, pcSoft is still applying lots of Objective-C and unless they're moving into
Swift as apple is also moving away from Objective-C sooner or later and I am sure
pcSoft is doing such as well.

I do receive lots of compiling warnings said those were deprecated even I'm using
wm22.

Are you using ios 11.3.1 instead of 11.1.3?

Regs

King
Posté le 25 mai 2018 - 09:56
Hi, sorry but I disagree to some extent, particularly in relation to this problem.

Yes iOS (even Android and Windows) are always behind. I accept that. That is why I write my own XCode and include it in my projects when necessary. For example automated calling etc. You only need to do some Googling to find procedures you can change to your own requirement but it does require you to learn XCode to some degree.

Regards my specific problem I do not think it is because I am not up to date, although I stand to be corrected. This is definitely a threading issue and something SIGNIFICANT has changed. It is either iOS or WM but even on WM21 it will provide an error response.

The problem I face is that I cannot get to see any error message. That will then allow me to investigate the problem and determine where the problem lies.

I accept that the answer might well be I need to upgrade WM but that is not what I am bothered about.

However if PCSoft have changed threading management so much in WM22/23 then why have we not heard about it? It's a major change. Apple for their part HAVE changed threading management as there is a lot about it on the Apple Newsgroups.

So all I want to know is how to get an error message to show when working across threads.

Thx.