I am writing an iOS app for a web site. This site is built using Wordpress. I have the overall UI structure built but I don't know I can connect to the sites server to get the needed data (posts, post titles, etc) to display through the app.
How can I do this?
To start, if the site is configured in the usual way, you can add ?feed=rss2 to the URL of your WordPress-driven site to request an RSS2 feed.
Basically, you're going to NSURLConnection and the URL Loading System to fetch the RSS feed, and then parse it. You can then use NSXMLParser to read the feed, and turn it into data collections and/or model objects to hold the data. Your UI can then load and display that data as you like.
Related
I'm trying to build an app (using Swift), it will have different functions (perhaps login, news, small forum, statistic...), but in general, I will have rss feed generated from the web.
My question is - what's the best practice for to store the RSS? Do I need to use core data?
For login, its obvious, I need web server (Parse or whatever), but for feed data?
You don't need CoreData, but it's always recommanded by Apple to use it when saving and handling data (from RSS feeds or else). Also, you should look at Superfeedr (which I created!) rather than poll the feeds yourself.
How Can I Incorporate my WordPress Blogs into an iOS app? I have a beautiful word press site and I want to create a native iOS app. I have knowledge of coding for iOS, but I just don't know how I would go about showing all the latest blogs that are up in a beautiful way.
Thanks in Advance!
There are many ways you can achieve that. Here is a list of things you need to do in order to make an iOS app for your WordPress blog:
1) You need to parse the data from your WordPress blog to display it inside your iOS app. You can do it by parsing your blog's RSS feed you can parse JSON.
2) If you are planning to parse the RSS feed, use NSXMLParser to do that. There are other third party libraries available that parse the XML feeds but i would suggest to go with the built in NSXMLParser as there is plenty of help available online for it.
3) If you are planning to parse JSON data, install Feed JSON plugin on your WordPress blog. Once installed, you can go to http://example.com/feed/json to get the JSON data. (You can replace example.com with your blog's URL)
4) To connect to the web services like XML feed and JSON on your blog, you can use third party libraries like AFNetworking or you can use Apple's built in libraries like NSURLConnection and other classes to connect and download the data from the webservice.
5) Here are some very easy tutorials for the steps above. How to Use NSURLConnection, How to fetch JSON or How To Parse RSS with NSXmlParser
You can start your app by completing the above steps and getting started.
6) After that one of the most important thing is to download images asynchronously in the UITableViewCells where you are displaying your blog posts. I would suggest you to download a video from Stanford University's iOS programming course on iTunes U that shows how to do it or you can simply find some tutorials or look for questions on StackOverflow.
7) Then you have to create a UIWebView and when the row of any blog post inside the UITableView is tapped, you can use the link to segue in the UIWebView to show the actual blog post. You can use didSelectRowAtIndexPath in order to pass data between view controllers.
8) Below the view controller that contains the UIWebView, you can add functions like stop, refresh, sharing on Facebook and Twitter etc.
9) As you can see that is a lot of work and business people just think that its easy to develop an iOS app but the truth is that it takes some time to completely package the app and submit to the App Store. You can also outsource your project by using service like Convert WordPress Blog To iOS App that is completely for free if you share revenue with them but its your choice and i recommend you to code it yourself to have complete ownership of you app.
Rest is just a matter of choice of different functions you would like to make in your app to stand out from the rest. You can add a Facebook style sliding navigation controller on the left side to create and parse specific categories on your blog, you can use Flipboard style swiping in your Web View etc etc. For that stuff there are a lot of third party libraries available.
Hope this helps!
You can read an answer of mine about cloud based ios apps (the db is online) here:
press me
now as i said, to get info from the server you need to use JSON, in wordpress there is a very good and simple plugin for that: JSON API
now the use of that is simple, you can see it in the notes: http://wordpress.org/plugins/json-api/other_notes/
but for example for getting the last posts in the system you need to run the url: http://www.example.org/api/get_recent_posts/
The /api means it's the plugin (you can change that in the settings) and the /get_recent_posts/ is the function.
there are many other functions like this one for everything you need and it can get more complicated than that based on what you want to get from the db.
After running the "query" and getting a response in JSON you need to use it:
Working with JSON in iOS 5 Tutorial
now for the running of the url i recommend to use AFNetworking
now all you need to do is use the json string you get for getting out info.
this would have some more issues like managing html codes you get in the content respons and so but it's the start, develop your way up :)
I want to create native iOS app, which must display static content of some website (for example, news website). I just need to display news categories, articles' text and images in my native iOS app.
How is it better to get content of website? What is the usual way to do that?
Ask website's developers for website's api? Or using some iOS SDK tools to get web content?
Thanks for help!
Asking the webmaster for the API is the best and easiest way, if they provide.
You can get the specific content you need via crawling script
written by Python. Run the python script on your own server to fetch
the articles under news category over and over, analyze the content
and extract the useful part, finally provide your own API for your native iOS app. This costs more.
Straightway, create NSURLRequest to load the webpage content, and do
the analysis task on the client instead. This affects the user experience.
You can use an UIWebView to load websites.
If the developer provides you a website API with XML or JSON you can create a UITableView with the news titles and a UIViewController to load the news details, but I don't think any developer would do it for you.
I'd like to use iOS to post on my users's facebook walls/tickers/news feeds. I learned that opengraph can be very specific about the actions users take inside my app, and I'd like to integrate them into my project.
I think I realize now I am going to need my own server running for opengraph actions to work ,right? or is this not a must? from what I understand, the server supplies the basic data to facebook for the post, like image, main text, secondary text etc...
Is my server needed just to supply the facebook posts' data? Is my server called everytime a facebook page is loaded with my app's contents? Or is it done only once, and facebook is copying the posts' content into facebook's servers?
What happens if my servers is not responsive etc?
The short answer: yes, you probably need a server.
The longer answer:
The facebook documentation on Open Graph is much better than what I can fit here. If you have not already, check out this page and its links: https://developers.facebook.com/docs/opengraph/.
A published action on facebook is a tuple { user, action, object }. The types of actions and objects are defined in the facebook developer application (developers.facebook.com/apps).
The content of the post is generated by your iOS client. The post has data that references the action by name and the object by its URL.
The individual objects that your app defines are typically represented by pages on your web server. These pages are scraped by Facebook to extract metadata that defines the object, including images and text. I do not know of safe assumptions you can make about when the object's page will be scraped.
It is possible to create sample objects when you are editing your object types (developers.facebook.com/apps, create or edit one of your apps, "Edit Open Graph", "Add Sample Data"). However, because these are intended for experimentation, they are fairly limited in what you can do with them.
I have a web site. This is a drupal site using PostgreSQL database.In this web site we can get direction data from one city to another by going to direction tab and giving start and end location.go to this URL and check that. http://www.zoomsrilanka.com/pathfinder .
direction data is loaded to dashboard. I want export that direction data to a iPhone so that this data can be used another application in the iPhone. If I tell in another words I want to send that data and need to store in a iPhone so that it can be used for another task. I want to know that how to store data in iPhone?
If you have control for the website you mentioned, You can create one webservice which will give you the required data in XML format by accepting parameters from iPhone.
i.e. you can call webservice from iPhone passing parameters and your webservice will provide response to that request in the form of XML and on receiving XML you can parse that and use according to your requirement.
It's not possible to share data between different IPhone applications. Each application has it's own "storage".
You can create API if you have access of server which you mentioned, API should give XML/JSON in response, so iPhone can take this response and parse accordingly, and store structure in sqlite local database.