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

  • SEARCH
  • Home
  • 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 3608664
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:31:46+00:00 2026-05-18T21:31:46+00:00

Ok, I think its possible I’ve misunderstood the correct way to implement an external

  • 0

Ok, I think its possible I’ve misunderstood the correct way to implement an external screen on the iPad and it is causing me a lot of headaches.
Since this is a long post, what I’m trying to do is create and send a view to an external screen over VGA, and remove the screen once I’m done with it. I’m having retain count issues so can’t get it to work.

I have a view controller that can be called up onto the iPad at any time. When this view loads (it is a remote, similar to Keynote presentation) I check for an external screen, then create a window and add a view to the extra monitor.

in my ipadViewController.h <– the view that stays on the iPad

I have

@interface ipadViewController : UIViewController {

PresentationViewController *presentationView;
UIScreen *externalScreen;
UIWindow *externalWindow;
}

@property (nonatomic, retain) UIScreen *externalScreen;
@property (nonatomic, retain) UIWindow *externalWindow;
@property (nonatomic, retain) PresentationViewController *presentationView;
@end

(There is more, but that is the external screen stuff).

in ipadViewController.m:

@synthesize externalScreen;
@synthesize externalWindow;
@synthesize presentationView;

So I try to do a few things when the view loads:

Get the external screen (if possible)
Create apresentationViewController and add it to the extra screen

- (void)viewDidLoad {
[super viewDidLoad];

[self getExternalScreen];
[self createPresentationAndSendToWindow];
}

to get the screen I do the following getExternalScreen::

if ([[UIScreen screens] count] > 1)
{
    for (UIScreen *currentScreen in [UIScreen screens])
    {
        if (currentScreen != [UIScreen mainScreen])
            self.externalScreen = [currentScreen autorelease];
    }

}

and to send the view to it createPresentationAndSendToWindow::

if (self.presentationPath == nil) return;
PresentationViewController *viewController = [[PresentationViewController alloc] initWithNibName:@"CanvasPresentation" bundle:nil];


self.presentationView = viewController;
[viewController release];

if (self.externalWindow == nil)
{
    CGRect externalBounds = [self.externalScreen bounds];
    self.externalWindow = [[[UIWindow alloc] initWithFrame:externalBounds] autorelease];

    [self.externalWindow addSubview:self.presentationView.view];

    self.externalWindow.screen = self.externalScreen;

    [self.externalWindow makeKeyAndVisible];
}

in dealloc I try to cleanup with:

[presentationView release];
[externalScreen release];
//[externalWindow release]; <- that would crash

Problem I have is that when I dismiss the remoteViewController (it is modal), after releasing externalScreen has a retain count = 1 and externalWindow has retain count = 2.

The crash caused by externalWindow release disappears if I don’t release presentationView (but then I’m leaking presentationView.

  • 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-05-18T21:31:47+00:00Added an answer on May 18, 2026 at 9:31 pm

    Your problem is here:

    for (UIScreen *currentScreen in [UIScreen screens])
    {
        if (currentScreen != [UIScreen mainScreen])
            self.externalScreen = [currentScreen autorelease];
    }
    

    Remove the autorelease. You shouldn’t be releasing something you didn’t create or retain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know off a way or maybe think its possible to connect Node.js
I think its possible but i cant come up with the right algorithm for
Based on a simple test I ran, I don't think it's possible to put
Its possible I am just really really thick. However, looking over the SDK for
This is the URL. http://www.tumblr.com/ I think that its based on prototype, and is
Can anyone tell me if its possible to extract the linq2sql generated classes into
I think it's better to release the version of the software which your developers
Currently in our enterprise we have a situation that i think it's not very
The PHP documentation can be found here , but I think it's rather lacking.
I'm seeing an ambiguous error in Firebug. I don't think it's particularly related to

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.