Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9018939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:39:28+00:00 2026-06-16T04:39:28+00:00

I am writing one iPhone application which is integrated with CPP code, I am

  • 0

I am writing one iPhone application which is integrated with CPP code, I am using C interface file as common interface in-between Objective-C and CPP code.

I am trying to display a new view from my current view by use of following code:

viewTowController *screen = [[viewTwoController alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:screen animated:YES];

I have used this code previously also but it was on button click event and it worked perfectly fine, but i need to display some views based on events generated from CPP code (on callback functions which are getting invoked from CPP).

When i call this code from a CPP call back function like below:

-(void) displayView
{
    viewTwoController *screen = [[viewTwoController alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:screen animated:YES];
}

//-- C Interface Function Implementation --//
void onDisplayView(void *self)
{
    [(id) self displayView]; 
}

I am unable to see the view added to the screen and i am get bunch of below errors in the console logs window.

2012-12-18 18:03:02.128 p2pwebrtc[5637:5637] *** _NSAutoreleaseNoPool(): Object 0x4f04520 of class UIView autoreleased with no pool in place - just leaking
Stack: (0x305a2e6f 0x30504682 0x309778ac 0x7db6 0x7d28 0x33bb 0x6fb0 0x1af865 0x1afb4a 0x1afc5e 0x62a1 0x373e 0x4672 0x39937f 0x3ca1e4 0x3ca265 0x3cc6 0x926d8155 0x926d8012)

AM I doing anything wrong in this one, or there is other way of doing it?

UPDATE **

As suggested in the answers I need to execute this code in UI Thread and for that i need to do below code :

dispatch_async(dispatch_get_main_queue(), ^{
    [(id) self displayView];
});

When i call this code in Objective-C function OR CPP function i get ERROR 'dispatch_get_main_queue' was not declared in this scope.

Also i am using OSX version 10.5.8 and Xcode version 3.1.3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:39:29+00:00Added an answer on June 16, 2026 at 4:39 am

    Ensure you’re calling into UIKit on the main thread, like so:

    void onDisplayView(void *self) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [(id) self displayView];
        });
    }
    

    If you’re targeting an older version of iOS (pre-GCD) you could do this instead

    // assuming `self` inherits from NSObject, of course
    void onDisplayView(void *self) {
        [self performSelectorOnMainThread:@selector(displayView) withObject:nil waitUntilDone:NO];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m writing one application which encrypt and decrypt data using AES (ECB) mode.
I want to create one simple application for sending request from iphone(client) by using
I'm writing an iPhone app which downloads a tar-gzipped file from a Webserver, then
Am writing one small application to parse from XML to JSON object for iphone.
I'm writing an iPhone Application using the ASIHTTPRequest (http://allseeing-i.com/ASIHTTPRequest/) library for REST interactions to
I want to share my sqlite database between two iphone applications In one application
I am writing an iPhone application. In one of my views the user will
In my Iphone application I am trying to navigate from one table view controller
I am writing an iPhone app that allows you to browse images in one
I'm currently re-writing one of my old PHP scripts so that the code is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.