A group of tasks that you monitor as a single unit in Swift language by Apple.
Questions tagged [dispatchgroup]
47 questions
0
votes
2 answers
dispatch_group_wait is not working in Objective-C
Creating dispatch group
dispatch_group_t group = dispatch_group_create();
I am making 3 same api calls with dispatch wait
[self updateFrequency1];
dispatch_group_wait(group, 3.0);
[self updateFrequency2];
dispatch_group_wait(group, 3.0);
[self…

Code cracker
- 3,105
- 6
- 37
- 67
0
votes
1 answer
Nested dispatch queues not firing inner dispatch queue
I have a pair of nested dispatch queues. For some reason the code inside the second one never gets fired:
dispatchGroupOne.notify(queue: .main) { [weak self] in
// Gets here
self?.dispatchGroupTwo.notify(queue: .main) {
// Doesn't get here
…

Tometoyou
- 7,792
- 12
- 62
- 108
0
votes
1 answer
How to use DispatchGroup to update UI only after for-in loop has completed
When a user taps a button, that triggers a lengthy function consisting of an API call and calculations.
@IBAction func buttonTapped(_ sender: Any) {
var itemIndex = 0
let dispatchGroup = DispatchGroup()
for…

amirbt17
- 533
- 1
- 4
- 13
0
votes
1 answer
I create an instance of 3 different view models and assign each to a state object. How do I place this into a dispatch queue?
I have a Swift program that works as desired. I have 3 view models that each call a separate model. Each model calls a function that reads a separate large CSV file, performs some manipulation and returns a data frame. This takes some time and I…

Chris
- 105
- 8
0
votes
2 answers
How connect DispatchGroup and Executed Request Alamofire?
I have a simple task with threads, but what seems to help everyone else, doesn’t work for me and I don’t understand why.
This is my button processing:
AnyButton(action: {
if isPhoneMode {
…

Orlov.iosdev
- 13
- 2
0
votes
0 answers
How to fetch newly written objects in coredata
I'm trying to first call one function that saves data from firebase to Coredata, and when it's done executing call another function that takes that data from coredata and uses it. I'm using a dispatchGroup and this is my code:
let dispatchGroup =…

Pontus
- 44
- 13
0
votes
1 answer
Using DispatchGroup with Streaming API?
I'm currently using a DispatchGroup to be notified when two API calls have completed, and then combine both responses into 1 object, that I then return in a completion handler.
This works for rest apis, however once I use this with two streaming…

VAlexander
- 86
- 6
0
votes
1 answer
issue with URLSession.shared.datatask and dispatchgroup
I am still very new to swift, so bear with me. I am having an issue, where this app works fine on my dev machine after being archived, and gatekeeper signed. but on other users machines, it fails to return the variables. I wanted to get it working…

Speck
- 3
- 3
0
votes
0 answers
Swift Dispatch Group Question Threading Questions
Will there be any potential bug if the code written like this?
Basically the dispatch group's notify closure is already on main thread but my tech lead added DispatchQueue on main again inside the notify closure.
I tried to push on removing…

Jay
- 35
- 1
- 7
0
votes
1 answer
Instagram Graph API - Avoid "Media Posted Before Business Account Conversion" error in swift
I am trying to get data from instagram through the instagram Graph API. For that, I use a url with a parameter called limit, which returns a Json. Limit will always be over 1, and can go up to 12. Limit is representative of how many of the last…

Abv
- 354
- 2
- 13
0
votes
2 answers
using dispatchgroup wait for task completion in for loop and exit from loop if failure
I am trying to exit from for loop according to condition but I ran into the issue as it does not exit even from the loop.
Here is a loop of my code.
var isFailure = true
let dispatchGroup = DispatchGroup()
var myFailureTask: Int?
for item in 1...5…

Prashant Ghimire
- 518
- 4
- 20
0
votes
1 answer
Combining DispatchGroup and DispatchQueue
My scenario is like this. I need to send a Network Request, in response i will become a list of Image URLs. I would then need to send multiple network requests concurrently to get all of these Images and once i have all the Images downloaded , I…

dev_ios999
- 339
- 3
- 9
0
votes
1 answer
async deletion task won't work if guest count is more than 1
So my goal is to delete all user's guests if the guest count for a purchased ticket is over 1 when a user is deleting their account.
Currently I have this function to try to accomplish this:
func deleteUserGuests(completion: @escaping (_ done: Bool)…

dante
- 105
- 11
0
votes
0 answers
Dispatch Group Crash BUG IN CLIENT OF LIBDISPATCH: Too many nested calls to dispatch_group_enter()
Getting Dispatch Group Crash with Too many nested calls to dispatch_group_enter(). I double checked the code and there is balance of enter and leave calls. This is happening in Prod for customers. I am not able to reproduce the issue. Can someone…

SreekanthI
- 393
- 3
- 13
0
votes
0 answers
Dispatch group vs calls in loop
What is the benefit of using a dispatch group with calls in the loop?
I am using alamo fire as my network layer. The scenario is that I want to fetch data from the server in chunks and once all calls are done I can move forward. Do I really need to…

Syed Meesum Ali
- 31
- 5