Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 25, 2010, 12:19 PM   #1
newtoiphonesdk
macrumors 6502a
 
Join Date: Jul 2010
NSString For Capturing Title and Description of WP Article?

I am taking what I have learned with NSString for getting the currentURL of a webview, and incorporating it into the JSON Format String for FBConnect Publishing to Wall. Is there any way of capturing the Title and Description of a Wordpress Article as an NSString?
In the FBConnect Post To Wall Format, how do I put in an NSString for one of the HREF? This is the format:
Code:
dialog.attachment = @"{\"name\":\"Facebook Connect for iPhone\","
		"\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\","
		"\"caption\":\"Caption\",\"description\":\"Description\","
		"\"media\":[{\"type\":\"image\","
			"\"src\":\"http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg\","
			"\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],"
		"\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}";
And I would like to take the site, and replace it with the currentURL NSString, and then also, find a way to get an NSString for the Title of whatever the blog is on the current article the WebView shows. Does that make sense?

OK, I changed
Code:
name\":\"Facebook Connect for iPhone\","
		"\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\
to
Code:
name\":\"Facebook Connect for iPhone\","
		"\"href\":\"%@\
and then put the currentURL at the end of the string.
This allowed me to put in the currentURL for the link that clicking on the Name will take you to. However, I would like the Name to be the current Title for whatever blog article the user is currently on. How do you go about doing this?

Last edited by newtoiphonesdk; Aug 25, 2010 at 01:33 PM. Reason: More Information
newtoiphonesdk is offline   0 Reply With Quote
Old Aug 25, 2010, 04:32 PM   #2
ianray
macrumors 6502
 
Join Date: Jun 2010
Location: @
Quote:
Originally Posted by newtoiphonesdk View Post
...I would like the Name to be the current Title for whatever blog article the user is currently on.
See UIWebView method stringByEvaluatingJavaScriptFromString. It seems like you will have to run some javascript to do what you want.
__________________
My App Store Apps: Dashometer, Exinf, Score&Grade
ianray is offline   0 Reply With Quote
Old Aug 25, 2010, 04:46 PM   #3
newtoiphonesdk
Thread Starter
macrumors 6502a
 
Join Date: Jul 2010
Thanks. I'll check that out
UPDATE:
I checked out stringByEvaluatingJavaScriptFromString. In the button for emailing I made the code to look like this for part of it:
Code:
{self.currentURL = sermons.request.URL.absoluteString;
	self.title = [sermons stringByEvaluatingJavaScriptFromString:@"document.title"];
This way I can get the currentURL of the webview, and also the Title for the article the webview is currently on.
In the body of the email I can set it to
Code:
NSString *emailBody = [NSString stringWithFormat:@"%@", self.title];
OR
Code:
NSString *emailBody = [NSString stringWithFormat:@"%@", self.currentURL];
Either of those will work to pull in the Document Title, or the current URL of the webView. What I would like to do is have both of these. I tried doing an stringByAppendingString, but got the Warning that NSString may not respond to stringWithFormat+stringByAppendingString and it crashed the App when I tried. Is there a way I can get all of these to work?

Last edited by newtoiphonesdk; Aug 26, 2010 at 09:50 AM. Reason: UPDATE
newtoiphonesdk is offline   0 Reply With Quote
Old Aug 26, 2010, 03:10 PM   #4
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by newtoiphonesdk View Post
I tried doing an stringByAppendingString, but got the Warning that NSString may not respond to stringWithFormat+stringByAppendingString and it crashed the App when I tried. Is there a way I can get all of these to work?
Post the code that doesn't work.

You've described your code, but we can't debug descriptions of code.

We need to see the actual code.
chown33 is offline   0 Reply With Quote
Old Aug 26, 2010, 03:15 PM   #5
newtoiphonesdk
Thread Starter
macrumors 6502a
 
Join Date: Jul 2010
I got that part working, just trying now to figure out how to pull the innertext with just the text of the article and not the rss button and everything else in the HTML not associated with the article text
newtoiphonesdk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Youtube title and description Lost Hammer iPod touch 0 Oct 3, 2007 03:13 PM
I am trying to find out the title and artist of a song Steff Music Discussion 10 May 15, 2006 08:46 PM
Games for my mac and substory of my loss vgame64 Games 13 Feb 19, 2006 12:51 AM
time magazine and end of world article jefhatfield Community 41 Jul 1, 2002 06:09 PM


All times are GMT -5. The time now is 01:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC