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 925317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:30:01+00:00 2026-05-15T19:30:01+00:00

I have taken the MailComposer example added to a simple project and under a

  • 0

I have taken the MailComposer example added to a simple project and under a button I am executing the following code:

// display in app email
MailComposerViewController *emailClient = [[MailComposerViewController alloc] init];
[self.view addSubview:emailClient.view];
[emailClient showPicker:self];
[emailClient release];

Last line is give me headache. If I don’t put that like I create a memory leak, if I add that line the mail client shows up but then the app hangs when I click cancel or send.
With the memory leak (aka no last line) everything works fine.

What is the best way in a very well know case like this?
I want to create an option in the same method and that object has delegates and such.
It’s not worth to have that object alive for the entire life of the app.

Thanks,
amok

  • 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-15T19:30:01+00:00Added an answer on May 15, 2026 at 7:30 pm

    You need to keep a view controller while you’re using the view managed by the said view controller.
    Instead, you need to have an instance variable or a property in which you keep emailClient.

    It’s great that you want to use as small an amount of memory as possible; but sometimes it’s just necessary to keep some objects alive.

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

Sidebar

Related Questions

I have taken over a large code base and would like to get an
We have taken over some .NET 1.1 Windows Service code that spawns threads to
I have taken over maintenance of a very large (>2M SLOC) software project, all
I have taken the code from the SDK and made just one modification to
I have taken a copy of a database home with me so I can
I have taken an image from UIImagePickerController , but the file looks too big
I have taken an AI course, and the teacher asked us to implement a
Say suppose 10 developers have taken 6 months to develop some application. As a
I installed Resharper in VS2008 and it seems to have taken over some of
Recently, many programmers and that includes me, have taken the X out of AJAX,

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.