Discussion Forums  >  Uncategorized

Replies: 4    Views: 294

MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
07/24/11 02:03 PM (14 years ago)

Possible to add body text on image emailer?

I'm working on an app that will have different screens that allow image emailing depending on the topic the person is viewing. Each image emailer will need to append flickr tags to allow for distribution to flickr sets. I can add the tags to the subject line, but that makes it pretty easy for someone to change them or delete them. I'd like to append the tag in the body text below the image insertion. Is this possible? I've gone through the Xcode and found the code that controls the email creation, but not sure if what I want to do is possible, Anyone have any suggestions?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/24/11 11:44 PM (14 years ago)
This means you probably found the sendEmailWithScreen data method in the BT_viewControllerManager.m file. This is the method that sets up the email compose sheet. This is the place you'll be placing your custom body text. For sure you can insert whatever you want in the body text before the email compose sheet opens...so the user sees the text when it does open. The image is added as an attachment. The text is added as [pickerSetBodyMessage:yourCustomString isHTML:NO] (you could also create an html string and set isHTML to yes. The trick will be figuring out which screen the user is on when you create the text. Because you mentioned different image emailing based on a topic, you'll need to discover which screen the user is viewing before adding your body message. Another way to say it, different screens need different body messages inserted. Psuedo code would be something like... if([[theScreenData.jsonVars objectForKey:itemId] isEqualToString:the screen id are looking for]){ [pickerSetBodyMessage:@'my cool body' isHTML:NO]; } if([[theScreenData.jsonVars objectForKey:itemId] isEqualToString:another screen id to look for]){ [pickerSetBodyMessage:@'<html><body>another message in html</body></html>' isHTML:YES]; } That should get you going?
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
07/25/11 06:39 AM (14 years ago)
Great. Thanks, as always. I'll play with it today and see what I can do.
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
07/25/11 06:09 PM (14 years ago)
@David. Thanks for the idea above. After a lot of trial and error, I came up with a pretty clean solution. Seems to work fine and it allows me to add addition pages without recompiling for an if/then. Can you think of any problems with this? //attach apps image if(imageAttachment != nil){ NSData *imageData = UIImageJPEGRepresentation(imageAttachment, 1.0); if(imageData){ [picker addAttachmentData:imageData mimeType:@image/jpeg fileName:imageAttachmentName]; } NSString *emailMessage = @; emailMessage = [appDelegate.rootApp.currentScreenData itemNickname]; [picker setMessageBody:emailMessage isHTML:NO]; }
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
07/25/11 09:17 PM (14 years ago)
Code guru! That should work, assuming you want the nickname to be used as the body. Do this though...have a look at the BT_config.txt file in your project and make sure the nicknames are included in a the Image Uploader type screens. If my memory is right there are a few screen-types that do not include their nickname in the JSON data when it's downloaded from our backend. Long story as to why, funny. Oh, you could just test and look for this if it's not working too. I've added this to the to-do list, seems like a good feature to allow pre-filled-text on image email screens.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.