Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
Is it possible to update a UITextView from a background thread?
My code crashes when I try updating the UITextView from the background thread. updates to UITextField and UILabels work just fine. No problem at all, but for some reason the text view doesn't work.
I've search the web and it seems many people have run into this problem, but I haven't found any clear solutions.
hmmm.... that's what they say. But my app updates tons of UI elements on bg with no problems at all. labels, textfields, imageviews, buttons. All no problem. But as soon as I try to update the UITextView it crashes.
now that I think about it, that's can't be true about UI elements. A progress bar view is a UI element and it wouldn't make any sense at all to update that on the main thread. the only useful way to update it is on a background thread.
You do the UI change on the main thread, even for a progress bar. Perhaps you aren't coming from a background thread as often as you may think. Often times the crash message will specifically say that the UI was updated from a background thread.
now that I think about it, that's can't be true about UI elements. A progress bar view is a UI element and it wouldn't make any sense at all to update that on the main thread. the only useful way to update it is on a background thread.
No, Brian is right. Even a progress bar should only be updated by the main thread. The event that triggers the update may very well come from a background thread, but the proper way to connect that background event and the updating of the progress bar is through one of the many inter-thread synchronization methods such as "run selector on main thread". I forgot the exact method name.
No, Brian is right. Even a progress bar should only be updated by the main thread. The event that triggers the update may very well come from a background thread, but the proper way to connect that background event and the updating of the progress bar is through one of the many inter-thread synchronization methods such as "run selector on main thread". I forgot the exact method name.
Replies
SlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeGCD has much more flexible methods that let you perform a block on the main thread, along with all the advantages of blocks.
To the OP: Everybody is speaking truth. Do not update the UI on a background thread.
From a background thread, this line:
which can also be written as
Should be written as:
Duncan C
WareTo
Animated GIF created with Face Dancer, available for free in the app store.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome