nsthread Questions

7

Solved

How do I check which one is the current thread in Swift 3? In previous versions of Swift it was possible to check if the current thread was the main one by doing this: NSThread.isMainThread()
Ivon asked 3/9, 2016 at 14:6

12

Solved

Is there a way to determine the line of code a certain method was called from?
Flowerage asked 20/9, 2009 at 15:57

4

Solved

Xcode's "thread list" pane shows English-like names for several special threads: com.apple.main-thread, com.apple.libdispatch-manager, com.dispatchfractal.opencl, com.dispatchfractal.opengl, com.ap...
Thirion asked 24/9, 2012 at 17:55

4

Solved

I need a long running task to be done in background as well as in foreground. This updates the core data. So to maintain UI responsive I created an another thread where I use different managedObjec...
Crossruff asked 14/3, 2013 at 9:26

3

Solved

I am trying to create a thread in swift and send two parameters. I create thread and this work: let thread = NSThread(target:self, selector:"getData", object:nil) thread.start() But how to send ...
Wirehaired asked 2/10, 2014 at 12:50

1

Solved

When I call scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: on the main thread and set time interval to 5 seconds code below timer gets executed, and after 5 seconds timer selector...
Sharilyn asked 7/9, 2012 at 18:31

4

NSOperationQueue creates many threads, as you'd expect, and desire. But when you pause the app and debug it in Xcode, it's unclear which threads belong to one operation queue and which belong to an...
Picoline asked 21/3, 2013 at 23:14

2

Solved

I have an audio file which needs to fade out while the user is scrolling a UIScrollView. However, any performSelector:withObject:afterDelay: method is blocked until the user has stopped scrolling. ...
Polycotyledon asked 16/11, 2010 at 14:18

3

Solved

My app uses NSInputStream like below: inputStream.delegate = self; [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [readStream open]; and delegate: - (...
Myall asked 7/11, 2015 at 21:12

3

Solved

I know UIView are not thread safe so i cant add a view on a background thread, to work around this is it ok to create a UIView on a background thread then add it on the main thread? Note: the reas...
Maulstick asked 20/6, 2012 at 15:30

1

Solved

According to the documentation of CLLocationManagerDelegate The methods of your delegate object are called from the thread in which you started the corresponding location services. That thread m...

3

Solved

I have an application which utilizes OpenEars and the Flite library. The problem is that the Flite library is resource intensive and it's freezing up my app. I suspect that running Flite on a backg...
Chatelaine asked 5/12, 2010 at 19:5

1

I have a function like this: func foobar() { let targetThread = Thread.current DispatchQueue.main.async { UIView.animate(withDuration: 0.5, animations: { // Code I need to run on the main thr...
Waki asked 7/3, 2017 at 19:57

1

I have: NSStatusItem with a custom view (scrolling text in a secondary thread), with the secondary thread updating the internal state and notifying the main thread with setNeedsDisplay. On mouseD...
Stereograph asked 2/10, 2012 at 18:55

2

Solved

The following things are what I know & understand: Global queue is a concurrent queue which can dispatch tasks to multiple threads. The order of executing task is not guaranteed. e.g.: dispatch...
Operculum asked 23/6, 2016 at 19:57

4

Solved

I'm doing an app that loads the contents of viewControllers using NSThread while is reading an XML file. I have it done as follows: -(void)viewDidAppear:(BOOL)animated { // Some code... [NSTh...
Neal asked 13/9, 2011 at 11:42

3

Solved

I want to simulate a communication with a server. As the remote server will have some delays I want to use a background thread that has on it [NSThread sleepForTimeInterval:timeoutTillAnswer]; ...
Justinajustine asked 15/8, 2013 at 9:21

2

Solved

So I have an application that fires a series of asynchronous events and then writes the results to a buffer. The problem is that I want the buffer to be written to synchronously (in the thread that...
Manifestative asked 15/1, 2016 at 19:57

1

Solved

My scenario looks like this: I have a class which has a function in it and this function makes a POST request to a server with NSURLSession. In another function which is not in that class I call th...
Reade asked 5/10, 2015 at 14:19

1

I have created a custom AVFoundation camera and loaded into another view as subview with @IBDesignable, after the image is taken I would like to assign it to UIImageView, But when the button is pre...
Scourge asked 14/9, 2015 at 19:58

3

Solved

I have some code where I am using dispatch_semaphore_t to signal operation completion. When the semaphore is a member variable, it does not seem to behave correctly. I will show example code that w...
Scooter asked 21/8, 2013 at 17:25

2

I have test code like this - (void)viewDidLoad { [super viewDidLoad]; NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(test) object:nil]; [thread start]; } -(void)te...
Pastor asked 25/7, 2014 at 9:35

1

Solved

I have a second question after reading Marcus S. Zarra's (excellent) Core Data: Data Storage and Management for iOS, OS X, and iCloud (2nd edition) if I may. The book's section Asynchronously Addi...

1

Solved

I'm trying to understand Operations and Threads better, and looked to AFNetworking's AFURLConnectionOperation subclass for example, real-world, source code. My current understanding is when instan...

4

I'd like to make a Thread with multiple arguments. Is it possible? I have the function: -(void) loginWithUser:(NSString *) user password:(NSString *) password { } And I want to call this functi...
Arianaariane asked 24/2, 2010 at 16:26

© 2022 - 2024 — McMap. All rights reserved.