Questions tagged [dispatch-async]
437 questions
1
vote
2 answers
Choppy scroll on UITableView displaying images from URL
I have an issue with my table view being choppy on scroll while it loads each image inside the function of cellForItemAtIndexPath i've searched through some examples and these are the things i've tried and still have the same issue.
So i have…

Konstantinos Natsios
- 2,874
- 9
- 39
- 74
1
vote
1 answer
How to write asynchronous thread classes in iOS?
In my App I need to run more than 300 threads asynchronously [Each thread dies within 500ms] . In Android I write an ayncTask class and run my code inside of it. How Can we do in iOS, I need a class not a function.
Please Provide any example,…

AMI amitekh
- 198
- 3
- 16
1
vote
1 answer
dispatch_async update variable crash - thread safety
When I run the following code multiple times app crashes at the line :
res.append(i)
The error is fatal error: UnsafeMutablePointer.destroy with negative count
or
pointer being freed was not allocated *** set a breakpoint in malloc_error_break to…

user584263
- 375
- 5
- 18
1
vote
1 answer
UIView screen freeze when calling dispatch_async(dispatch_get_main_queue())
I have a popup which need to be show until all the images are uploaded on the view controller, I use dispatch-async method to show the popup before all the images are uploaded and hide as the images display.
But the UIView screen freezes…

fmashkoor
- 113
- 1
- 2
- 6
1
vote
1 answer
Getting the following error: This application is modifying the autolayout engine from a background thread
I get this warning with this code.
I am checking in the background if an update is available. And then present an alert.
Obviously Xcode and iOS don't like my thinking... any ideas?
…

George Asda
- 2,119
- 2
- 28
- 54
1
vote
1 answer
What is the difference between perform a method directly and in the block of dispatch_async(dispatch_get_main_queue(), ^{})
I find that in some cases, the result that I perform [self doSomething] directly is different from that I perform in the block of a GCD body like this:
dispatch_async(dispatch_get_main_queue(), ^{
[self doSomething]
})
I have perform…

wkx
- 431
- 1
- 4
- 7
1
vote
1 answer
EXC_BAD_ACCESS on a dispatch_get_main_queue()
I have this code, and some times the variable dConfiguration is Nil and I get a EXC_BAD_ACCESS error and most of the time the variable said 0 key/value pairs, and the error is almost imposible to reproduce, I just click my button and most of the…

Stornu2
- 2,284
- 3
- 27
- 47
1
vote
6 answers
Loading a image using dispatch_async within cellForRowAtIndexPath
Im trying to load an image from an url.
Following is my code..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = nil;
cell = (UITableViewCell *)[tableView…
user6092898
1
vote
1 answer
TCP Stream and dispatch in iOS
I have to build an application which also will be able to receive and send data.
I need to create at least two threads. One to continuously listen and to respond to an interface and sending data.
var a = connectionClass()
@IBOutlet weak var…

WujoFefer
- 29
- 7
1
vote
1 answer
Showing spinner using spinKit in iOS while fetching JSON
What I am trying to do is, on a click of a button I am fetching data using AFNetworking pod. What i want is after fetching data I want to display NSLog(@"/n /nAfter fetching"); but it is coming before the json data.
Here is the code I have written…

Sharad Chauhan
- 4,821
- 2
- 25
- 50
1
vote
1 answer
Swift 2 Button Label text change when thread completed
I'm running a series of dispatches, and when the final one is finished, I want to change the label of a button. Changing swift, however, doesn't like when UI component changes are made outside of the main thread. Sometimes it works. Sometimes it…

dbconfession
- 1,147
- 2
- 23
- 36
1
vote
2 answers
Objective-C: Get a result of a singleton-class method after finish executing the method?
I have a singleton class that checks the login status of the app.
There's a method named attemptToLogin in the singleton class that makes an http request with parameters and returns with json data about the login status. (true or false)
Now in the…

Fadi Obaji
- 1,454
- 4
- 27
- 57
1
vote
1 answer
dispatch_async and unexpected non-void return value in void function in Swift
I have a function in my appDelegate that returns user's current location.
Now I want to call it asynchronously at some other place and I did:
func handleLocation() -> CLLocation {
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
…

randomuser1
- 2,733
- 6
- 32
- 68
1
vote
1 answer
Swift. Running async download in the background and let user interact with UI
The following function is being used to synchronize the app with json data from a server and this takes up a few a minutes if the content hasn't been updated for a while. As for now, the app blocks the main UI and tells the user that it's updating…

floyd0987
- 31
- 7
1
vote
1 answer
CoreSpotlight Indexing - Image Loading
I am assigning values to CSSearchableItem using CoreSpolight framework. I want to optimise image loading.
func setupSearchableContent(moviesInfo:NSMutableArray)
{
if #available(iOS 9.0, *)
{
var searchableItems =…

Taimur Ajmal
- 2,778
- 6
- 39
- 57