Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: threading on android run smoothly but ios 9.2 make iphone freeze



Permlink Replies: 5 - Last Post: Jul 14, 2016 5:13 PM Last Post By: Stephen Corbett
anang ganjar

Posts: 4
Registered: 11/21/04
threading on android run smoothly but ios 9.2 make iphone freeze
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2016 7:57 AM
hi,

i want ask about threading on ios,
my problem show since update ios to 9.2 version.
i have make app when active it will check if empty database then will download content from web server using json
(download use threading with show progress indicator).
before update its work but since ios 9.2 not working anymore event will make my iphone freeze.
if i try to make download content from web server using json without threading its no problem.

any suggestion about threading on ios?

Fyi :
- same app with threading run smoothly on android
- i have try different threading style
//classic style
TMyThread = class(TThread)
protected
  procedure Execute; override;
end;


//anonthread
FThread := TAnonymousThread<Boolean>.Create(.....


//Anonymous thread
TThread.CreateAnonymousThread(procedure ()
begin
end).Start;
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: threading on android run smoothly but ios 9.2 make iphone freeze
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2016 10:45 AM   in response to: anang ganjar in response to: anang ganjar
anang wrote:

before update its work but since ios 9.2 not working anymore
event will make my iphone freeze.

What does "not working anymore" mean exactly? What is it actually doing
that youare not expecting? Which version of Delphi are you using? Did you
verify that TThread is working correctly in general, and your Execute() override
is being called in the context of a thread different than the one that creates
the TThread object?

--
Remy Lebeau (TeamB)
anang ganjar

Posts: 4
Registered: 11/21/04
Re: threading on android run smoothly but ios 9.2 make iphone freeze
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2016 12:35 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Hi remy,
i use delphi seattle
i have build many app and test run on iphone since version 8.1 & app its work without problem until ios 9.1,
but when update into ios 9.2 there problem when build app, for this embarcadero provide hotfix ios 9.2 paserver
its said after copy hotfix paserver we have to recompile and rebuild app.
after rebuild my app show splash->loading aniindicator -> progressbar increase
first table download but when second table aniindicator stop spin & progressbar stop increase
i can't push home button then i have to hard reset iphone.

i can tell this long thread because i have 8 table to be download
i am curious if there something wrong with my download procedure then i try to run without threading
DownloadTable(1);
DownloadTable(2);
.
.
DownloadTable('8');

then app run and freeze (but i can push home button ) wait until finish then go to main menu, app run without problem

is there new rule about threading on ios 9.2?

Edited by: anang ganjar on Jan 2, 2016 12:37 PM
Chris Rolliston

Posts: 332
Registered: 4/6/00
Re: threading on android run smoothly but ios 9.2 make iphone freeze
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2016 12:09 PM   in response to: anang ganjar in response to: anang ganjar
any suggestion about threading on ios?

On both iOS and Android, Delphi implements TThread using the *nix pthreads API, so in principle behaviour should be similar. Could you create a short, compiling example that demonstrates the problem...?
Guest
Re: threading on android run smoothly but ios 9.2 make iphone freeze
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 19, 2016 7:48 AM   in response to: Chris Rolliston in response to: Chris Rolliston
Chris Rolliston wrote:
any suggestion about threading on ios?

On both iOS and Android, Delphi implements TThread using the *nix pthreads API, so in principle behaviour should be similar. Could you create a short, compiling example that demonstrates the problem...?

Ok, so first I just had

procedure Form1.Button1Click(Sender:TObject);
var
cn:=Connection;
begin
cn.loadData('thisnthat')
end;


in loadData i have 1. a WebService getting the Data (with HTTPRIO) and 2. getting the Data into a table, and all of that is wrapped in a anonymous thread

//the loadata procedure is in a datamodule and gets called from the mainform
TThread.CreateAnonymousThread(procedure()
begin.
///load webservice and store data into db
end).Start;


when i just do:

//this is inside the button click event
TThread.CreateAnonymousThread(procedure()
begin.
showmessage('stuff')
end).Start;

everything works fine. But if i make something bigger, the app just crashes, after or a little before the thread finishes - means that app is still there, but i cant hit any buttons, and eventually itll close.


Any help?

Edit: Well, ill edit something in here for more clarity, doesnt seem like i was paying attention to what i was writing..
Also, it did work on iOS 9.2, but with Delphi XE8, now with Seattle it seems to be broken.

Edited by: Francisco Künzi on Jan 19, 2016 3:55 PM

Stephen Corbett

Posts: 17
Registered: 2/10/11
Re: threading on android run smoothly but ios 9.2 make iphone freeze
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 14, 2016 5:13 PM   in response to: anang ganjar in response to: anang ganjar
I'm not sure if you found a solution to this but I'm running into similar problems on iOS 9.3. Looking at the device logs using XCode gives some insight to the problem. If I use a TTask to run the background task (updating a SQLite DB) I get an EXC_RESOURCE exception of type WAKEUPS, a "NONE-FATAL CONDITION (this is NOT a crash)" which still terminates the app. I'm guessing that the main thread is polling the TTask to see if it's finished. If I use a plain old TThread ig get a '00000020' exception with a note of 'SIMULATED (this is NOT a crash)' that also terminates the application.

Has anyone else run across this and solved this problem?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02