Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-20-2008, 08:07 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2008
Location: Munich, Germany
Posts: 108
freshking is on a distinguished road
Default Problem with UITextView, NSUTF8StringEncoding and email

Hi,

I have a uitextview which displays me the some data. Sometimes it fills out my textview (you need to scroll down) and sometimes it doesn't.
Now I want to send this data via email useing NSUTF8StringEncoding.
The problem is when the textview is not filled out the app imports the data properly into Mail but if the text is filled out the email-button doesn't call any action. It just gets clicked down but nothing happen.
This is my code I am using:

Quote:
- (IBAction)start {

myTimer1 = [NSTimer scheduledTimerWithTimeInterval:0.10 target:self selector:@selector(timerFired: ) userInfo:nil repeats:YES];

recordingText.text = [NSString stringWithFormat: @"Recording Started:\n%s\n", [[[NSDate date]
descriptionWithCalendarFormat:@"%a, %d %b %Y %H:%M:%S" timeZone:nil
locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]]
UTF8String]];
Quote:
- (void)timerFired: (NSTimer *)timer{

recordingText.text = [NSString stringWithFormat:@"%@\nX: %f Y: %f Z: %f", recordingText.text, x , y , z];
}
Quote:
- (IBAction)email {

NSString *gtv = recordingText.text;

NSString *urlString = [NSString stringWithFormat:@"mailto:?subject=iPhone&body=%@" , gtv];

NSString *fixedURL = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8St ringEncoding];
NSURL *url = [NSURL URLWithString:fixedURL];

[[UIApplication sharedApplication] openURL:url];
}
Doe anybody see the problem? What am I doing wrong?
Thanks alot!
freshking is offline   Reply With Quote
Old 12-30-2008, 04:52 PM   #2 (permalink)
Registered Member
 
Join Date: Oct 2008
Location: Munich, Germany
Posts: 108
freshking is on a distinguished road
Default

I have noticed that this problem only occurs when the text gets too long. If its just short mail will be fired without any problems. But when too long you can tap the button to send via email as much as you like and nothing happens.
Maybe this gives somebody the clue to solving my problem here.
Thanks!
freshking is offline   Reply With Quote
Old 01-07-2009, 04:15 PM   #3 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 5
mrarick is on a distinguished road
Default

I'm having the same problem with a long body in my mailto URL. Did you find a solution to your problem?
mrarick is offline   Reply With Quote
Old 01-07-2009, 04:38 PM   #4 (permalink)
Registered Member
 
Join Date: Oct 2008
Location: Munich, Germany
Posts: 108
freshking is on a distinguished road
Default

Actually I did. This is the code I am using. Note that I use the NSUTF8StringEncoding for the subject and the NSUTF32BigEndianStringEncoding for the body.

Quote:
- (IBAction)someAction {

NSString *subject = [@"Some subject" stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];

NSString *body = [myUITextView.text stringByAddingPercentEscapesUsingEncoding: NSUTF32BigEndianStringEncoding];

NSString *urlString = [NSString stringWithFormat:@"mailto:?subject=%@&body=%@",bet reff,body];
NSURL *url = [NSURL URLWithString:urlString];

[[UIApplication sharedApplication] openURL:url];

}
freshking is offline   Reply With Quote
Old 01-09-2009, 08:10 AM   #5 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 5
mrarick is on a distinguished road
Default

I'm having limited success with this solution. It works for short messages, but I'm still having problems with long messages. It doesn't seem to matter if I use NSUTF32BigEndianStringEncoding or NSUTF8StringEncoding. The body of my message is sometimes 2-3KB. Does anyone know what the URL size limit is for the iPhone mail application? Without support for attachments, this is really a limiting factor for getting data off the iPhone.
mrarick is offline   Reply With Quote
Reply

Bookmarks

Tags
email, nsutf8stringencoding, problem, uitextview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 350
7 members and 343 guests
doffing81, dre, iOS.Lover, Kirkout, MikaelBartlett, PlutoPrime, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:06 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0