iOS Email contents of UIWebView and post to Facebook

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I am working on an app that has a WebView of a wordpress blog that I set up. I have seen other blog apps that you can click to either send an email that has the entire contents of the article, or post it to Facebook. How is this done?
 

seepel

macrumors 6502
Dec 22, 2009
471
0
I'm not familiar with JavaScript, but it seems like this is a candidate for the stringByEvaluatingJavascript: method sf UiWebview.
 

dejo

Moderator
Staff member
Sep 2, 2004
15,981
450
The Centennial State
Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7)

For email, there's the MessageUI framework. For Facebook, there's Facebook Connect. For something that handles these and more (incl. Twitter), consider something like ShareKit.
 

dejo

Moderator
Staff member
Sep 2, 2004
15,981
450
The Centennial State
How would I code either of those choices to do it?
I'm not sure exactly what answer you are looking for. I would start by looking at the documentation for those things, understanding how they are used in sample code, maybe going through some tutorials, etc. If that's not what you want, please explain specifically what kind of answer you seek.
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I thought I was specific. I have an app with a webview that pulls in a blog. I want to make a button to email the contents of the blog article in the window and also be able to post to fb
 

dejo

Moderator
Staff member
Sep 2, 2004
15,981
450
The Centennial State
Wirelessly posted (Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16)

No, you're being specific in what you are trying to achieve. Now you need to be specific in what help from us you are trying to solicit.
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
Ok , specifically I want you to tell me the code that will pull the article from the webview and put it in the body of an email when the button is pressed
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I don't want the app built for me. I need one part help on learning how to make the button that will email contents of the article. I only mentioned in jest you code it for ne comment because the one post said I wasn't being very specific and I knew of no other way to be more specific beyond the original post.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
24,873
219
Harrogate
And he told you exactly which part of the documentation you need to read. That is all a programmer needs. The next step is writing the code. There is nothing in between.
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I have never programmed before and apples documentation is confusing and doesn't offer any sample code for doing what I'm trying. Is it too much to ask for a small sample code for pulling contents of view to am email body?
 

chown33

Moderator
Staff member
Aug 9, 2009
8,726
5,042
vertical
I have never programmed before and apples documentation is confusing and doesn't offer any sample code for doing what I'm trying. Is it too much to ask for a small sample code for pulling contents of view to am email body?
Why do you think such "sample code" would be small? Just because it can be summarized in 50 words or less doesn't necessarily mean it can be coded in 50 words, or 50 lines, or even 50 pages.

So yes, it is too much to ask.

If you don't know how to solve it yourself, then break it down into sub-problems you can solve by yourself. Or study the necessary features and functions until you can solve it yourself. You'd better get used to this process, because it's what all programming really is: figuring out how to do something you didn't know before, then doing it.

Example of Breaking It Down (a principle called decomposition):
pull the article from the webview and put it in the body of an email when the button is pressed
1. Pull the article from the webview.
2. Put it in the body of an email.
3. When a button is pressed.

Decomposing 3:
3a. Define a button in IB.
3b. Define an action method.
3c. Connect the button to the action method.

Decomposing 1:
1a. Decide on a representation for the article. NSString or NSAttributedString or something else. It depends on what you're trying to send in the email.
1b. Find a method of the view that returns a type close to what you want, or exactly what you want.
1c. Perform any conversion on the data, such as line-wrapping or whatever, that might be needed for sending as an email.

Decomposing 2:
2a. Investigate email API: classes, methods, etc.
2b. See how API affects represention from 1a.
2c. Decompose into further sub-parts: addressing email, setting subject, setting body, sending, etc.


If you find Apple's docs confusing, then it suggests you're in over your head, and should go back and review whatever is confusing you. Again, get used to this process, because it will happen continuously.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.