Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
I have been trying to get this setup so that I can this pass it to a MailComposer to email the content from mywebview. I found a blog that said to use this
Code:
NSString *currentURL
= myWebView.request.URL.absoluteString;
However, it doesn't say where to implement this at, or how/where to declare it. In the view controller I have this code currently running for the webview.
Code:
- (void)awakeFromNib
{
	[sermons loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://theipadpreacher.wordpress.com"]]];
	timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];
	
}
I'd Like to be able to set up an emailcomposer sheet so that I could email the contents of this from the app, and I don't know if I'm missing something simple, or if I need to completely rewrite the webview part of the code and where to put the code for getting the current url from the webview. Thanks
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
The blog that you copied the code from (apparently without bothering to understand it) called the variable that points at their webview "myWebView". You appear to have called your "sermons". It should be clear what you need to change.
 

robkwok

macrumors newbie
Aug 22, 2010
3
0
The blog that you copied the code from (apparently without bothering to understand it) called the variable that points at their webview "myWebView". You appear to have called your "sermons". It should be clear what you need to change.

right, so if you webview is called sermons, you just need to call sermons.request.URL.absoluteString to get the url string
 

newtoiphonesdk

macrumors 6502a
Original poster
Jul 30, 2010
567
2
The blog that you copied the code from (apparently without bothering to understand it) called the variable that points at their webview "myWebView". You appear to have called your "sermons". It should be clear what you need to change.

The blog I got it from had nothing in it but that one line of code. It was called get current URL in the blog title and all the article had was that one line of code. Where do I put the code in? In the same awakefromnib line of code ?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
The blog I got it from had nothing in it but that one line of code. It was called get current URL in the blog title and all the article had was that one line of code. Where do I put the code in? In the same awakefromnib line of code ?

Wherever it makes sense. Think about it. If you put it in awakefromnib you'll get the URL at that point in time. Which sounds wrong to me.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.