---
title: "Executing performSelectorOnMainThread on multithreaded app in iOS?"  
description: "Executing performSelectorOnMainThread on multithreaded app in iOS?"  
author: "Anonymous User"  
published: 2015-12-09  
updated: 2015-12-10  
canonical: https://www.mindstick.com/forum/33710/executing-performselectoronmainthread-on-multithreaded-app-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Executing performSelectorOnMainThread on multithreaded app in iOS?

When I was creating a multithreaded app in [iOS](https://www.mindstick.com/articles/12222/core-data-and-how-to-use-it-in-ios-objective-c), I noticed that the following [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) will call the main thread:

```
[self performSelectorOnMainThread:@selector(rollBar:)                       withObject:nil                    waitUntilDone:false];
```

but, I [am unable](https://answers.mindstick.com/qa/95314/how-do-i-access-a-group-link-in-telegram-if-i-am-unable-to-access-the-link) to create multithreaded app, so please [anyone tell me](https://www.mindstick.com/interview/23033/can-anyone-tell-me-about-hadoop-toolbox) the correct [procedure](https://www.mindstick.com/forum/32/stored-procedure-return-datatype) to create multithreaded [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) and what code we use in other [controllers](https://www.mindstick.com/forum/155773/how-asynchronous-controllers-work-in-asp-dot-net-mvc) to get [functionality](https://www.mindstick.com/blog/136/using-watermark-functionality-in-textbox-by-jquery) of multithread in our app.

Thanks.

## Replies

### Reply by Tarun Kumar

AppDelegate's init method:

```
NSLog(@"First Thread:  %@", [NSThread isMultiThreaded] ? @"Yes" : @"No");[self performSelectorOnMainThread:@selector(setDelegate:) withObject:self waitUntilDone: NO];NSLog(@"Second Thread: %@", [NSThread isMultiThreaded] ? @"Yes" : @"No");
```

when you run this code, the output in the console will look like this:

```
2015-12-11 11:46:28.296 MyApplication[82963:20b] First Thread: No2015-12-11 11:46:28.297 MyApplication[82963:20b] Second Thread: No
```

The second thread is also written in NSLog statement into method applicationWillTerminate:, and this told me it was not multithreaded.


---

Original Source: https://www.mindstick.com/forum/33710/executing-performselectoronmainthread-on-multithreaded-app-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
