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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:29:47+00:00 2026-06-09T20:29:47+00:00

I am very new to Xcode, and I am trying to write an app

  • 0

I am very new to Xcode, and I am trying to write an app that will allow the user to use the camera, take multiple pictures, and then allow the user to choose the pictures they would like to attach to an in-app email.
I am getting errors such as:

Incompatible pointer types passing "UIImagePickerController *" to parameter of type "UIImage *"

and

Instance method '_alloc' not found (return type defaults to 'id')

and

Incompatible pointer types sending 'UIImage *' to parameter of type 'NSString *'

and

Unused variable 'photoData'

Here is my code

// Camera Control

-(void) takePhotoClicked
{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])

    {
        UIImagePickerController *theimagepicker = [[UIImagePickerController alloc] init];

        theimagepicker.delegate = self;

        theimagepicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        theimagepicker.mediaTypes = @[(NSString *) kUTTypeImage] ;
        theimagepicker.allowsEditing = NO;
        [self presentModalViewController:theimagepicker animated:YES];
        [theimagepicker release];
        newMedia = YES;

    }
}

// Choose Photo Control

-(void) choosePhotoClicked
{
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum])
    {
        UIImagePickerController *theimagepicker = [[UIImagePickerController alloc] init];

        theimagepicker.delegate = self;

        theimagepicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        theimagepicker.mediaTypes = @[(NSString *) kUTTypeImage];
        theimagepicker.allowsEditing = NO;
        [self presentModalViewController:theimagepicker animated:YES];
        // Save image
        UIImageWriteToSavedPhotosAlbum(theimagepicker, self, @selector(theimagepicker:didFinishSavingWithError:contextInfo:), nil);
        NSLog(@"Creating Mail Data!!!");
        NSData *photoData = [[UIImageJPEGRepresentation([UIImage imageNamed:@"qwerty.png"], 1) alloc] init];

        [theimagepicker release];
        newMedia = NO;

    }
}



// Image Delegate Methods

-(void)theimagepickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo: (NSDictionary *)info
{
    NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
    [self dismissModalViewControllerAnimated:YES];
    if ([mediaType isEqualToString:(NSString *)kUTTypeImage])
    {
        UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];

        theimageView.image = image;
        if (newMedia)
            UIImageWriteToSavedPhotosAlbum(image, self, @selector (image:finishedSavingWithError:contextInfo:), nil);


        NSLog(@"Creating Mail Data!!!");
        NSData *photoData = [[UIImageJPEGRepresentation([UIImage imageNamed:@"qwerty.png"], 1) alloc] init];


    }
    else if ([mediaType isEqualToString:(NSString *) kUTTypeMovie])
    {


        // Code here to support video if enabled
    }
}

-(void)image:(UIImage *)image
finishedSavingWithError:(NSError *)error
 contextInfo:(void *)contextInfo
{
    if (error) {
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle: @"Save failed"
                              message: @"Failed to save image"
                              delegate: nil
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
        [alert show];
        [alert release];

    }

}

// Email Control
#pragma mark - Open the mail interface
-(IBAction)email
{
    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
    [composer setMailComposeDelegate:self];
    if([MFMailComposeViewController canSendMail])
    {
        //  NSString *custemail = txtCustomerEmail.text;

        //  NSArray *toRecipients = [NSArray arrayWithObject:custemail];
        // [composer setToRecipients:toRecipients];

        [composer setSubject:@"Title Search results:"];

        [composer addAttachmentData:photoData mimeType:@"image/jpg" fileName:[UIImage imageNamed:theimageView.image]];




        // Fill out the email body text
        NSString *emailBody =[NSString stringWithFormat:@"Examiner Name :%@\nExaminer Address :%@\nExaminer City :%@\nExaminer State :%@\nExaminer Zip Code :%@\nExaminer Email Address :%@\nCustomer Name :%@\nCustomer Address :%@\nCustomer City :%@\nCustomer State :%@\nCustomer Zip Code :%@\nCustomer Email Address :%@\nSearch Through Date :%@\nTitle Held By :%@\nProperty Address :%@\nProperty City :%@\nProperty State :%@\nProperty Zip Code :%@\nProperty County : %@\nTitle Search Notes :%@\nMortgage 1 Lender :%@\nMortgage 1 Dated :%@\nMortgage 1 Recorded :%@\nMortgage 1 Amount :%@\nMortgage 1 Book Number :%@\nMortgage 1 Page Number :%@\nMortgage 1 Assignment :%@\nMortgage 1 Additional Info :%@\nMortgage 2 Lender :%@\nMortgage 2 Dated :%@\nMortgage 2 Recorded :%@\nMortgage 2 Amount :%@\nMortgage 2 Book Number :%@\nMortgage 2 Page Number :%@\nMortgage 2 Assignment :%@\nMortgage 2 Additional Info :%@\nMortgage 3 Lender :%@\nMortgage 3 Dated :%@\nMortgage 3 Recorded :%@\nMortgage 3 Amount :%@\nMortgage 3 Book Number :%@\nMortgage 3 Page Number :%@\nMortgage 3 Assignment :%@\nMortgage 3 Additional Info :%@\nLien/Judgement 1 Creditor :%@\nLien/Judgement 1 Type ;%@\nLien/Judgement 1 Dated :%@\nLien/Judgement 1 Recorded :%@\nLien/Judgement 1 Amount :%@\nLien/Judgement 1 Book Number :%@\nLien/Judgement 1 Page Number :%@\nLien/Judgement 1 Notes :%@\nLien/Judgement 2 Creditor :%@\nLien/Judgement 2 Type ;%@\nLien/Judgement 2 Dated :%@\nLien/Judgement 2 Recorded :%@\nLien/Judgement 2 Amount :%@\nLien/Judgement 2 Book Number :%@\nLien/Judgement 2 Page Number :%@\nLien/Judgement 2 Notes :%@\nLien/Judgement 3 Creditor :%@\nLien/Judgement 3 Type ;%@\nLien/Judgement 3 Dated :%@\nLien/Judgement 3 Recorded :%@\nLien/Judgement 3 Amount :%@\nLien/Judgement 3 Book Number :%@\nLien/Judgement 3 Page Number :%@\nLien/Judgement 3 Notes :%@\nProperty Tax ID :%@\nProperty Tax Amount :%@\nHow Often Are Taxes Paid :%@\nNext Payment Due Date :%@\nNext Payment Due Amount :%@\nExaminers' Notes Line 1:%@\nExaminers' Notes Line 2:%@\nExaminers' Notes Line 3:%@\nExaminers' Notes Line 4:%@\nExaminers' Notes Line 5:%@\nExaminers' Notes Line 6:%@\nExaminers' Notes Line 7:%@\nExaminers' Notes Line 8:%@\nExaminers' Notes Line 9:%@\nExaminers' Notes Line 10:%@\nLegal Description Line 1 :%@\nLegal Description Line 2 :%@\nLegal Description Line 3 :%@\nLegal Description Line 4 :%@\nLegal Description Line 5 :%@\nLegal Description Line 6 :%@\nLegal Description Line 7 :%@\nLegal Description Line 8 :%@\nLegal Description Line 9 :%@\nLegal Description Line 10 :%@\nLegal Description Line 11 :%@\nLegal Description Line 12 :%@\nLegal Description Line 13 :%@\nLegal Description Line 14 :%@\nLegal Description Line 15 :%@\nLegal Description Line 16 :%@\nLegal Description Line 17 :%@\nLegal Description Line 18 :%@\nLegal Description Line 19 :%@\nLegal Description Line 20 :%@\nLegal Description Line 21 :%@\nLegal Description Line 22 :%@\nLegal Description Line 23 :%@\nLegal Description Line 24 :%@\nLegal Description Line 25 :%@\nLegal Description Line 26 :%@\nLegal Description Line 27 :%@\nLegal Description Line 28 :%@\nLegal Description Line 29 :%@\nLegal Description Line 30 :%@", txtExaminerName.text, txtExaminerAddress.text, txtExaminerCity.text, txtExaminerState.text, txtExaminerZip.text, txtExaminerEmail.text, txtCustomerName.text, txtCustomerAddress.text, txtCustomerCity.text, txtCustomerState.text, txtCustomerZip.text, txtCustomerEmail.text, txtSearchThroughDate.text, txtTitleHeldBy.text, txtPropertyAddress.text, txtPropertyCity.text, txtPropertyState.text, txtPropertyZip.text, txtTitleSearchNotes.text, txtMtg1LenderName.text, txtMtg1Dated.text, txtMtg1Recorded.text, txtMtg1Amount.text, txtMtg1BookNumber.text, txtMtg1BookNumber.text, txtMtg1PageNumber.text, txtMtg1Assignment.text, txtMtg1AddlInfo.text, txtMtg2LenderName.text, txtMtg2Dated.text, txtMtg2Recorded.text, txtMtg2Amount.text, txtMtg2BookNumber.text, txtMtg2PageNumber.text, txtMtg2Assignment.text, txtMtg2AddlInfo.text, txtMtg3LenderName.text, txtMtg3Dated.text, txtMtg3Recorded.text, txtMtg3Amount.text, txtMtg3BookNumber.text, txtMtg3PageNumber.text, txtMtg3Assignment.text, txtMtg3AddlInfo.text, txtLien1Creditor.text, txtLien1Type.text, txtLien1Dated.text, txtLien1Recorded.text, txtLien1Amount.text, txtLien1BookNumber.text, txtLien1PageNumber.text, txtLien1Notes.text, txtLien2Creditor.text, txtLien2Type.text, txtLien2Dated.text, txtLien2Recorded.text, txtLien2Amount.text, txtLien2BookNumber.text, txtLien2PageNumber.text, txtLien2Notes.text, txtLien3Creditor.text, txtLien3Type.text, txtLien3Dated.text, txtLien3Recorded.text, txtLien3Amount.text, txtLien3BookNumber.text, txtLien3PageNumber.text, txtLien3Notes.text, txtPropertyTaxID.text, txtPropertyTaxAmount.text, txtHowTaxesArePaid.text, txtNextPaymentDueDate.text, txtNextPaymentAmount.text, txt1ExaminersNotes.text, txt2ExaminersNotes.text, txt3ExaminersNotes.text,txt4ExaminersNotes.text, txt5ExaminersNotes.text, txt6ExaminersNotes.text,txt7ExaminersNotes.text, txt8ExaminersNotes.text, txt9ExaminersNotes.text,txt10ExaminersNotes.text, txt1LegalDescription.text, txt2LegalDescription.text, txt3LegalDescription.text, txt4LegalDescription.text, txt5LegalDescription.text, txt6LegalDescription.text, txt7LegalDescription.text, txt8LegalDescription.text, txt9LegalDescription.text, txt10LegalDescription.text, txt11LegalDescription.text, txt12LegalDescription.text, txt13LegalDescription.text, txt14LegalDescription.text, txt15LegalDescription.text, txt16LegalDescription.text, txt17LegalDescription.text, txt18LegalDescription.text, txt19LegalDescription.text, txt20LegalDescription.text, txt21LegalDescription.text, txt22LegalDescription.text, txt23LegalDescription.text, txt24LegalDescription.text, txt25LegalDescription.text, txt26LegalDescription.text, txt27LegalDescription.text, txt28LegalDescription.text, txt29LegalDescription.text, txt30LegalDescription.text];

        //

        [composer setMessageBody:emailBody isHTML:NO];

        composer.modalPresentationStyle = UIModalPresentationPageSheet;

        [self presentModalViewController:composer animated:YES];

        [composer release];
    }
    else
        [composer release];
}

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    if (error)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error"

                                                        message:[NSString stringWithFormat:@"error %@", [error description]]

                                                       delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil];


        [alert show];
        [alert release];

        [self dismissModalViewControllerAnimated:YES];

    }
    else {
        [self dismissModalViewControllerAnimated:YES];
    }
}
  • 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-09T20:29:49+00:00Added an answer on June 9, 2026 at 8:29 pm

    Okay, in the method “choosePhotoClicked” delete these lines

        UIImageWriteToSavedPhotosAlbum(theimagepicker, self, @selector(theimagepicker:didFinishSavingWithError:contextInfo:), nil);
    
        NSData *photoData = [[UIImageJPEGRepresentation([UIImage imageNamed:@"qwerty.png"], 1) alloc] init];
    

    Then remove this line from “didFinishPicking…”

        NSData *photoData = [[UIImageJPEGRepresentation([UIImage imageNamed:@"qwerty.png"], 1) alloc] init];
    

    Then in the action “email” replace this line:

        [composer addAttachmentData:photoData mimeType:@"image/jpg" fileName:[UIImage imageNamed:theimageView.image]];
    

    With these lines:

        NSData *imageData = UIImageJPEGRepresentation(theimageView.image, 1.0);
        [composer addAttachmentData:imageData mimeType:@"image/jpg" fileName:@"this is a string file name";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am very new to xcode and iOS and just getting use to
I am very new to the xcode.I just create a foundation tool app.But I
Im very new to Objective-C and am currently learning how to use Xcode and
I am trying to get an iPhone app packaged up. (I'm very new to
I'm very new to Objective-C. I'm trying to write a method where I create
I have an older app that does not use ARC. When trying to address
Im very new to xcode and i have a question to my first app.
I am very new to the Xcode environment. I would like to compile some
I'm new to Xcode. This is probably a very simple question to you, but
Very new to JQuery and MVC and webdevelopment over all. I'm now trying 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.