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

Similar Threads
thread Thread Starter Forum Replies Last Post
Emoji description wannabelean iOS 6 2 Apr 26, 2013 05:54 PM
How to program this? (Description in thread) meme1255 Mac Programming 5 Jan 10, 2013 01:44 PM
How to edit the file description? SashaNNNA Mac Applications and Mac App Store 1 Sep 23, 2012 08:00 AM

Forum Jump

All times are GMT -5. The time now is 10:26 AM.

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

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