Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

David Klein
Courses Plus Student 1,456 PointsMaking wordpress based blog apps
Hello guys, i'm wondering how can i make an iOS native apps using the data from wordpress/joomla/blogspot? do i need the xml file or json file from those blog? anyone can please explain to me how it works because i'm a bit confused. thank you.
6 Answers

Gareth Borcherds
9,372 PointsThe tutorial that they go through here on treehouse uses this plugin to create a json API on a wordpress blog. http://wordpress.org/plugins/json-api/ it works really well and gives you all that you would need to open up a wordpress site to build an app from the posts on it.
As for other platforms, I'm sure you can find similar things for the other platforms, but wordpress is my favorite and is recommend staying with it.

Gareth Borcherds
9,372 PointsThere are ways, but not very easy to implement and not recommended as you would most likely be violating copyrights without permission.

David Klein
Courses Plus Student 1,456 Pointswhat is the ways to do that? could you please tell me ? i'm not gonna put the app on the app store instead it just for fun for practicing objective c.

Gareth Borcherds
9,372 PointsJust use treehouse's the URL he uses in the tutorial still works.

David Klein
Courses Plus Student 1,456 Pointsok thanks.
Fred Lawton
5,904 PointsGareth, from my understanding I have a WordPress.com site (rather than a WordPress.org site) and so I can't install plugins.
How else can I access my wordpress blog's data?

Gareth Borcherds
9,372 PointsYou can try going the xml-rpc route as I know that's enabled for wordpress.com and I believe that's what they use for their mobile app that they have built, but other than that, I'm not super familiar with wordpress.com. I'd just go host it somewhere else ;)
Fred Lawton
5,904 PointsThanks Gareth!
Fred Lawton
5,904 PointsI tried looking into http://developer.wordpress.com/docs/api/.
Following the above link, I put https://public-api.wordpress.com/rest/v1/sites/bayareasportsfan4.wordpress.com/posts/?number=5&pretty=1 into my browser & shows the blog posts. However, there is formatting that seems like it will be a hassle to parse.

Gareth Borcherds
9,372 Pointsnot really, you can display the content in a webview and it'll convert all that formatting correctly. That should work pretty well for you.
Fred Lawton
5,904 PointsGareth, I'm only familiar with loading a url request using loadRequest.
I have the content in a string that contains the formatting. The string content is: "<p>Data, data, data. ... href=\"http:\/\/bayareasportsfan4.files.wordpress.com\/2014\/03\/20140301-001341.jpg\"><img ... 1 of the conference.<\/p>\n" except for brevity I added the ... in place of some content.
How do I show this in a UIWebView without the formatting?

Gareth Borcherds
9,372 PointsYou should use:
[webView loadHTMLString:string baseURL:nil];
But note, that you won't preserve line breaks. To preserve line breaks you'll need to replace \n with <\br> (or any valid line breaking html), so this turns into:
[webView loadHTMLString:[string stringByReplacingOccurrencesOfString:@"\n" withString:@"<br/>"] baseURL:nil];
Fred Lawton
5,904 PointsCool. I actually just found that method and used it.
It works, but I don't like the snapping back feature of the UIWebView. When I click and scroll to see the bottom of the UIWebView contents, when I release it snaps back up and hides some of the content on the bottom of the UIWebView.
Do you know how to fix this?
I really appreciate all your help!

Gareth Borcherds
9,372 PointsI'm not sure, it could be a number of things. I think we are at the limit of what I can help with.
David Klein
Courses Plus Student 1,456 PointsDavid Klein
Courses Plus Student 1,456 Pointsthanks for the good answer gareth, ubt i have some a problem which i want to build an apps just for fun using others people blog that using wordpress because i don't have mine. what if the blog owner refused to install json api plugin? is there anyway i can access his blog post data to make an apps?