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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:27:09+00:00 2026-05-13T13:27:09+00:00

there is a error in my iPhone app. I use the CameraPicker to make

  • 0

there is a error in my iPhone app. I use the CameraPicker to make and get a picture and then I give it to my methode sendPhoto, which will send the photo to TweetPhoto. Everything works great until I initialize an NSMutableDate with NSData. Here is the code:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissModalViewControllerAnimated:YES];
    NSData *imageData = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    [self sendPhoto:(NSString*)@"lola" tweet:(BOOL)TRUE photo:(NSData*)imageData tags:(NSString*)@"" longitude:(float)1024 latitude:(float)512];
}

Here is the sendPhoto-methode:

- (void)sendPhoto:(NSString*)message tweet:(BOOL)tweet photo:(NSData*)photo tags:(NSString*)tags longitude:(float)longitude latitude:(float)latitude {
    NSString *url;
    if (tweet) {
        url = [NSString stringWithFormat:@"http://www.tweetphoto.com/uploadandpostapiwithkey.php"];
    } else {
        url = [NSString stringWithFormat:@"http://www.tweetphoto.com/uploadapiwithkey.php"];
    }

    NSString * boundary = @"tweetPhotoBoundaryParm";
    NSMutableData *postData = [NSMutableData dataWithCapacity:[photo length] + 1024];
    //!!!Here is the error!!!!                      
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

    NSString * userNameString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"username\"\r\n\r\n%@", [prefs stringForKey:@"username_preference"]];
    NSString * passwordString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"password\"\r\n\r\n%@", [prefs stringForKey:@"password_preference"]];
    NSString * apiString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"api_key\"\r\n\r\n3eceaa7c-6d4d-41ab-be90-2a780e2d1961"];
    NSString * messageString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"message\"\r\n\r\n%@", message];
    NSString * tagsString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"tags\"\r\n\r\n%@", tags];
    NSString * latString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"latitude\"\r\n\r\n%f", latitude];
    NSString * longString = [NSString stringWithFormat:@"Content-Disposition: form-data; name=\"longitude\"\r\n\r\n%f", longitude];
    NSString * boundaryString = [NSString stringWithFormat:@"\r\n--%@\r\n", boundary];
    NSString * boundaryStringFinal = [NSString stringWithFormat:@"\r\n--%@--\r\n", boundary];

    [postData appendData:[boundaryString dataUsingEncoding:NSUTF8StringEncoding]];
    [postData appendData:[userNameString dataUsingEncoding:NSUTF8StringEncoding]];
    [postData appendData:[boundaryString dataUsingEncoding:NSUTF8StringEncoding]];
    [postData appendData:[passwordString dataUsingEncoding:NSUTF8StringEncoding]];
    [postData appendData:[boundaryString dataUsingEncoding:NSUTF8StringEncoding]];
    [postData appendData:[apiString dataUsingEncoding:NSUTF8StringEncoding]];
    [postData appendData:[boundaryString dataUsingEncoding:NSUTF8StringEncoding]];
    //(...)
}

(The sendImage-methode is by http://davidjhinson.wordpress.com/2009/06/01/posting-photos-using-objective-c/)

The console also says this: * Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘* -[UIImage length]: unrecognized selector sent to instance 0x3b28df0′

Thanks for your help. Maybe there is just a stupid mistake in the code by me, but please don´t be angry, because I´m just learning programming for 2 1/2 weeks.

  • 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-13T13:27:09+00:00Added an answer on May 13, 2026 at 1:27 pm

    It sounds like you’re passing a UIImage into this method, not an NSData chunk. Can you try logging the photo argument?

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

Sidebar

Related Questions

Is there a way to get more useful information on validation error? XmlSchemaException provides
I get this error: Can't locate Foo.pm in @INC Is there an easier way
If I get an error code result from a Cocoa function, is there any
I use this little snippet to halt my iPhone app in the simulator. NSAssert((0),
I'm developing an iPhone app which displays some tiles from a map. I've got
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I got this project, where there this error keeps occurring and its not on
Is there any way to trap an error and exit gracefully from Perl? I
Is there any good practice related to dynamic_cast error handling (except not using it
Is there any way to force PHP to blow up (error, whatever) if I

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.