Questions tagged [nsthread]

`NSThread` is part of the Objective-C Foundation Framework and provides developers a way to create and manage threads.

An instance of NSThread controls a thread of execution. Developers can use this class when they would like to perform a series of tasks in its own thread of execution. An example is if the developer wanted to have an Objective-C method run in its own thread of execution.

Threads are useful for long-running tasks that avoid blocking the main thread of the application (where user interface and event-related tasks are handled), as well as dividing a large task into several smaller sub-tasks. This can lead to performance improvements.

In GNUStep, NSThread essentially encapsulates OpenStep threading. Each process starts with a main thread and additonal threads can be created by using NSThread. The GNUStep implementation of OpenStep was designed so that the internals of the base library do not use threading (except in the case of methods that explicitly deal with threads). This makes it possible to write applications without any sort of threading.

References

729 questions
0
votes
3 answers

Dealing with two screens and one activity indicator in iOS

I have 3 screens on my app.First is login. Second is search and third is process the task. On login i retrieve data from a web service. It returns data in XML format. So the data is considerably large. So i am doing that task on a background thread…
RookieAppler
  • 1,517
  • 5
  • 22
  • 58
0
votes
2 answers

Hide NSTextView while some process is running

My code is something like this: - (void)buttonClick { [self.progressIndicator startAnimation:self]; [self.textView setHidden:YES]; // some process [self.progressIndicator stopAnimation:self]; [self.textView setHidden:NO]; } The…
0
votes
2 answers

How to create thread to checking time?

I have to setting a time to check for update data from server 2times a day, suppose 9AM and 9PM, but i don't know the way to do that. Create a thread, run every-time and check time current time with setting,if they are equal,so do task? This way is…
The Bird
  • 397
  • 2
  • 8
  • 19
0
votes
1 answer

UIActivity Indicator not showing up on ios app launch

I am trying to use the activity indicator in iOS and not able to. I followed a thread on Stackoverflow and using it like that. This is what i wrote: -(void)viewDidLoad { [NSThread detachNewThreadSelector:@selector(threadStartAnimating:)…
RookieAppler
  • 1,517
  • 5
  • 22
  • 58
0
votes
1 answer

NSOperation fails when switching the tab bar

I am using a TabBarController with two tabs. In the second I am calling an NSOperation, adding the operation to an NSOperationQueue. When I select the second tab, I have called this operation on the main thread. But when I switch to the first tab…
Nassif
  • 1,113
  • 2
  • 14
  • 34
0
votes
1 answer

Detail about nsrunloop

Possible Duplicate: Understanding NSRunLoop Till now I know that every thread has its own runloop I don't know whether I'm thinking right. I don't have a brief idea about nsrunloop but I'd like to know what is nsrunloop and what it's purpose and…
Exploring
  • 925
  • 6
  • 18
0
votes
2 answers

Cancelling a thread in objective-c

I would like to explain what I want to do by using C language with pthreads pthread_t tid1, tid2; void *threadOne() { //some stuff } void *threadTwo() { //some stuff pthread_cancel(tid1); //clean up } void setThread() { …
Sarp Kaya
  • 3,686
  • 21
  • 64
  • 103
0
votes
2 answers

NSThread causes UIWebView Crash

i would like to explain my issue from the beginning. I am creating a app with UIWebView. Also I am capturing the screen at the moment user using the app and create a video using that image array. I am using NSTimer to get screen shots of the screen.…
Sameera Chathuranga
  • 3,638
  • 3
  • 27
  • 48
0
votes
2 answers

performSelectorOnMainThread method not call

I have created a method that is running in new thread. [NSThread detachNewThreadSelector:@selector(setmostpopularReq:) toTarget:self withObject:mostPopulerstring]; After completed this method i send all data to main thread. [self…
user1512157
0
votes
1 answer

Multithreading with NSThread

I'm newbie with this so forgive me with any mistakes... My situation: - (id)initWith... //Some arguments There's an initialization method that returns an object. It does a lot of work to set its instance variables with the values of the arguments.…
Lluís
  • 578
  • 1
  • 5
  • 10
0
votes
2 answers

UIAlertView performSelectorInBackground

on iOS5 I can use method to show UIAlertView: [alert performSelectorInBackground: @ selector (show) withObject: nil]; on iOS6 crash my app, why? That the replacing? Thanks
Edi
  • 1,728
  • 2
  • 13
  • 13
0
votes
4 answers

Fire a NSThread every 'X' seconds

I'm having an issue with NSThread which I don't understand very well.. How to well create a NSThread: - (id)initWithTarget:(id)target selector:(SEL)selector object:(id)argument then... I'm a bit confuse with NSThread and all of his methods. I want…
xGoPox
  • 674
  • 8
  • 23
0
votes
2 answers

iOS get UITextField text in a thread ,that was show '_WebThreadLockFromAnyThread'

I want to get text of UITextField in a thread. IBOutlet UITextField *textSearchBar; { NSThread* thread ......init:@selector(test).... [thread start] } -(void)test { NSString* str = textSearchBar.text;//here to show …
zt9788
  • 948
  • 4
  • 16
  • 31
0
votes
1 answer

Can NSTableView column bound to coredata Entity NSArrayController in secondary thread work?

My program uses Coredata (SQLite), NSPersistentDocument, NSTableView and an (entity) NSArrayController. I want to have the NSTableView's columns in the Main thread bound to the entity NSArrayController that I have populated in a Secondary Thread.…
Luis Palacios
  • 396
  • 1
  • 3
  • 14
0
votes
1 answer

Using the same NSLock with two view controllers

I am running into a situation where the read and write operations (being done by two different threads and two different view controllers) to an XML file are overlapping. I tried the following logic to use the same NSLock with the two view…
Myxtic
  • 5,679
  • 5
  • 48
  • 69