Post

Replies

Boosts

Views

Activity

Reply to DispatchGroup.notify is being called before all instances have left the group
If that is the case, why should the first 5 work? The same example as earlier, no block objects associated. Theoretically it should have exited before anything executes at all. var count = 0 dispatch_group.notify(queue: .main) { print("Exited") } for i in 0...10 { dispatch_group.enter() } for i in 0...10 { if i.isMultiple(of: 2) { count += 1 print(i, "count:", count) dispatch_group.leave() } else { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { count += 1 print("MainAsync ", i, "count:", count) dispatch_group.leave() } } } The output: 2 count: 2 4 count: 3 6 count: 4 8 count: 5 10 count: 6 Exited MainAsync 1 count: 7 MainAsync 3 count: 8 MainAsync 5 count: 9 MainAsync 7 count: 10 MainAsync 9 count: 11 Am I missing something?
Sep ’24
Reply to DispatchGroup.notify is being called before all instances have left the group
var dispatch_group = DispatchGroup() dispatch_group.notify(queue: .main) { print("Exited") } for i in 0...10 { dispatch_group.enter() } for i in 0...10 { if i.isMultiple(of: 2) { print(i) dispatch_group.leave() } else { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { print(i) dispatch_group.leave() } } } @DTS Engineer Hope this will suffice
Sep ’24
Reply to DispatchGroup.notify is being called before all instances have left the group
If that is the case, why should the first 5 work? The same example as earlier, no block objects associated. Theoretically it should have exited before anything executes at all. var count = 0 dispatch_group.notify(queue: .main) { print("Exited") } for i in 0...10 { dispatch_group.enter() } for i in 0...10 { if i.isMultiple(of: 2) { count += 1 print(i, "count:", count) dispatch_group.leave() } else { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { count += 1 print("MainAsync ", i, "count:", count) dispatch_group.leave() } } } The output: 2 count: 2 4 count: 3 6 count: 4 8 count: 5 10 count: 6 Exited MainAsync 1 count: 7 MainAsync 3 count: 8 MainAsync 5 count: 9 MainAsync 7 count: 10 MainAsync 9 count: 11 Am I missing something?
Replies
Boosts
Views
Activity
Sep ’24
Reply to DispatchGroup.notify is being called before all instances have left the group
var dispatch_group = DispatchGroup() dispatch_group.notify(queue: .main) { print("Exited") } for i in 0...10 { dispatch_group.enter() } for i in 0...10 { if i.isMultiple(of: 2) { print(i) dispatch_group.leave() } else { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { print(i) dispatch_group.leave() } } } @DTS Engineer Hope this will suffice
Replies
Boosts
Views
Activity
Sep ’24
Reply to Unable to debug app on phone
@Developer Tools Engineer Getting this error while trying the workaround. WARNING: Unable to retrieve complete information for this device. The best available information will be returned. Error: The operation failed because Developer Mode is disabled.
Replies
Boosts
Views
Activity
Aug ’24
Reply to Previous preparation error: Developer Mode disabled; To use <My-Device-Name> for development, enable Developer Mode in Settings → Privacy & Security.
@Developer Tools Engineer Getting this error while trying the workaround. WARNING: Unable to retrieve complete information for this device. The best available information will be returned. Error: The operation failed because Developer Mode is disabled.
Replies
Boosts
Views
Activity
Aug ’24
Reply to Previous preparation error: Developer Mode disabled; To use <My-Device-Name> for development, enable Developer Mode in Settings → Privacy & Security.
UPDATE: Doesn't work with Xcode 16 Beta 4, 16 Beta 5, 16.1 Beta.
Replies
Boosts
Views
Activity
Aug ’24