Questions tagged [ios-multithreading]

59 questions
1
vote
1 answer

Why is my array size always equal to zero after I have appended several objects to it?

I've made two functions which call two different rest APIs with an HTTP GET request. I've made a class call "ExchangeObject" which encapsulates the data retrieved from the APIs into an object. In each call, I append an object of class ExchangeObject…
1
vote
1 answer

UICollectionView reloadData never goes through datasource

I am trying to display Data in a UICollectionView which worked perfectly exactly like i did in the whole app but for some reason, its not working in this case : Here is the code needed to understand the issue : SomeController : func…
1
vote
2 answers

Understanding dispatch_queues and synchronous/asynchronous dispatch

I'm an Android engineer trying to port some iOS code that uses 5 SERIAL dispatch queues. I want to make sure I'm thinking about things the right way. dispatch_sync to a SERIAL queue is basically using the queue as a synchronized queue- only one…
Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
1
vote
2 answers

Ocassional crash on the app start

I'm getting very strange crash at the start of the app. My app spawns a lot of threads (over 500, most of them are related to PLPreheatItem, I can not paste full crash log here, cause stackoverflow has limit to 30K symbols). The problem is that I…
1
vote
1 answer

How to stop a thread from running indefinitely in Swift?

I run a function from a library which I can't see the implementation. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ someClass.beginService(); }); This library class calls my class' delegate function. class…
Chen Li Yong
  • 5,459
  • 8
  • 58
  • 124
1
vote
1 answer

GCD setting scheduling/priority between threads

I am working on an app that captures frames from the camera and does blend over an image updated by another thread. My problem is that the image creating thread which is called every 500ms consumes peak computing power that influences the other…
Chris
  • 1,231
  • 2
  • 10
  • 20
1
vote
0 answers

Crash while using CFHostCreateWithName: "Attempt to start the Thread again"

help! I met a crash when i try to get the addresses for the give hostname; the crash log shows like this: 1 libobjc.A.dylib 0x0000000197d180e4 objc_exception_throw + 56 2 CoreFoundation 0x0000000186044218 -[NSException initWithCoder:] 3 Foundation…
0
votes
1 answer

How to make sure that OperationQueue tasks are always getting executed on background(global) thread in swift?

I encountered a problem with non-iOS developer while describing the flow of OperationQueue. We already know that with OperationQueue we can start as many threads as we want to execute the tasks in sync/async way. But in practical, some of the people…
Vin
  • 456
  • 6
  • 18
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 { …
0
votes
1 answer

Dispatch Group crash

I have created a method to fetch user messages from Firebase, however when leaving DispatchGroup app crashes leading to this error Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) I'm not sure what I'm doing wrong. Please help and…
0
votes
1 answer

SwiftUI: Return MLKit result to SwiftUI view not working

I have a ScannerService class that has the following function: func detectText(photo: UIImage) -> String { let textRecognizer = TextRecognizer.textRecognizer() let visionImage = VisionImage(image: photo) var textRecognized…
0
votes
1 answer

How to use newBackgroundContext() with URLSession.shared.dataTaskPublisher?

I have created a simple Core Data project at Github to demonstrate my problem: My test app downloads a JSON list of objects, stores it in Core Data and displays in a SwiftUI List via @FetchRequest. Because the list of objects has 1000+ elements in…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
0
votes
0 answers

iOS NSInternalInconsistencyException threading violation crash

I have an iOS SDK project that is consumed by third party iOS apps and recently there have been crashes reported around one API in the SDK and the cause is: threading violation: expected the main thread [name NSInternalInconsistencyException, reason…
zfgo
  • 195
  • 11
0
votes
1 answer

ViewDidAppear Not updating my picture from Firebase but update text info

I am still very new to IOS programming, and I've run into an issue while using the Firebase database and storage. Here is the image: : This is what the profile looks like before editing it. If the user hit the edit button, we will enter the editing…
0
votes
1 answer

Reader Writer Lock Implementation in Swift for multiple Properties

In my Swift class I have multiple properties. For these properties do I need to create different Concurrent Queue or I can use the same Queue? Please suggest which one will be better. import Foundation public class ImageCache{ public let shared…
Saleh Enam Shohag
  • 1,039
  • 1
  • 12
  • 23