Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a wordpress blog that's sort of a quote of the day type of a deal and I am looking to make a simple iPhone app that automatically downloads the blog content (think RSS—kind of). I want my readers to be able to save their favorite posts and I need to be able to show access to all archives (about 440 posts to date). I also need it to send a push notification when a new post is detected. Anyway, I have been looking at RSS feeds, but it looks like I can only show the last ten.
As far as iPhone programming experience, I'm by no means a noobie. However, I have mostly worked on game projects and I don't have very much experience with the internet side of programming (downloading, parsing, etc.).
Any ideas would be appreciated. I just need to be pointed in the right direction.
Here's what I would do, though I'm sure there are many solutions:
Get access to your WP blog as JSON instead of RSS (XML). In general, I've found the JSON libs to be much easier to work with than the XML libs in iOS. Here's the first plugin I came across, and it looks like it's an "API" instead of just a conversion of the feed. Hopefully this will give you more support for querying things like archives or specific posts or date ranges, etc.: http://wordpress.org/extend/plugins/json-api/
Decide if you want to load ALL content from each wp post, or just the titles. This kinda depends on how big each post is, how you're displaying them, etc. It might be quicker to just fetch + parse all the Post Titles and then make a subsequent query for a selected post's content.
Load the data with NSMutableURLRequest and NSURLConnection, etc. Use the json-framework to parse this data, once you get it into your app (I found it through the Stanford iOS dev lectures). Quite easily converts a json string into a NSDictionary: https://github.com/stig/json-framework/
As for loading all archives, ideally you can continually query for older posts with your wp json plugin, and maybe store the loaded post's timestamps on the device so that you don't need to fetch data more than once.
As for saving all this (including favorites), I'd look into using CoreData. http://developer.apple.com/library/ios/#documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
Push notifications are another beast entirely! I suppose the best approach would be to store push tokens of all your 'subscribers' somewhere on your server, then write some kind of php script that triggered your APNS service on an interval, checked for new posts, and sent out notifications accordingly.
Best of luck!
TouchJSON has native XML parsing support for Wordpress Blog RSS format. Try it out. You should be up and running in about an hour.
You can get TouchJSON from here
https://github.com/TouchCode/TouchJSON
Related
I am an absolute beginner in programming and I have set myself the goal of creating an app for our small association.
I would also like to create a kind of news feed on a page in which I can post local newspaper articles
can add manually. So selected articles. I know that it is probably very complex at the beginning, but I want to get an idea of how and what I need for it.
My question is, what hardware or software items do I need? Or how can that be done?
For now, I don't need any codes, I just need an overview of the means by which I can get there. And then I try to get used to it bit by bit.
I'm creating an app which generates a random question from a list (currently stored as a Numbers doc). Once that question is answered by the user, the unique question ID, the question itself and their answer is stored in core data.
When the user requests a new question one will be generated randomly from the original document and it will then be cross referenced with core data to find out if the user has previous answered that question.
I haven't included the code of my app at the moment as I'm not really looking for specific coding help. As someone who is new to the world of code I'm just looking for a nudge in the right direction for me to go and do more studying.
JSON looks like a possible, but the more I read about that the more it seems that it is about an app communicating with a website. I don't really want the questions to be accessed by just anyone, so putting them on my website might not work? Could I do it with a file local in the app? maybe a CSV?
I'm anticipating the file may become quite big as I add more questions - so I'm not sure if that changes things?
Thanks so much in advance, and apologies if this isn't quite the right way to ask questions on here.
I'm just looking for a nudge in the right direction for me to go and
do more studying.
There are many options to solve your problem. Each option depends on your skill, time and if the solution is even necessary for the app you want to make. In the end it's you who decides on which solution solves your problem. There are a few options:
creating your own backend
have a local file in your app
or use a third party service like Firebase.
Each option has its own benefits. Just to list a few:
Local file:
You could have a local file in nearly any format (XML, JSON, .plist) etc. The downside is that your app isn't dynamic - you have to manually keep adding text to this file and update your app trough the App Store for your users to see these changes. If you're going with this approach, I'd recommend using a .plist or a JSON file which is saved in your project. How to implement this correctly is beyond the scope of the question, but there are plenty tutorials out there to help you getting started.
You could put your data in a .plist file. This is nothing more than a dictionary with key-value data (same principle as JSON where each key has a value). An example:
question1 is the key, of type String, containing the value "How are you today". It's easy to read from this .plist since it's the same principle as JSON.
Also, JSON is just a format, it's used often to communicate with websites, but it's not limited to sites only.
Custom backend
This means that you make a backend on which your app can communicate with. You'd have to host your backend, write logic / code on your backend and so on. This can be very time consuming, especially if your app isn't that big/demanding. I wouldn't recommend this unless you have the experience, time, patience and need for this solution.
Third party
This can be a nice solution. Using a third party service like Firebase means that you have your data online. The Firebase library has been well tested and has great documentation to get you started. It's secure, fast, simple but .. it does take a little bit of time to learn how it works - but the end result is that you have a dynamic app where you can add, delete, edit questions and so on. This data can be protected if you wish - which means only authenticated users can access this data (Nobody else will be spying on your data :))
I don't really want the questions to be accessed by just anyone, so
putting them on my website might not work?
Read custom backend and Third Party.
Could I do it with a file local in the app?
Yes. Read Local file.
maybe a CSV?
That's possible but I wouldn't recommend it, but that's a personal opinion. I find it outdated and it's more difficult to work with than JSON.
I'm anticipating the file may become quite big as I add more questions
- so I'm not sure if that changes things?
What is a big file? Nowadays reading a "big" JSON file is probably nothing more than a few MB at most. Your phone reads this in no time. This won't be an issue for your phone or app.
I have been researching this all day, its more of a question to see if anybody can help.
I have already set up the push notifications on my iPhone app which i had a nightmare with but I've managed to do so.
I'm only a internship and have been developing apps for 4 months, its not my strongest subject as I haven't learned anything like this at uni.
My boss has asked me to add a view to the application so that you can view the most recent push notification that the app has received.
I know this is possible but I'm not sure how it's done, I have spoken to the developer who dealt with all of the server side of things (he doesn't have any knowledge of app development).
He said I would need a page that will read directly from the SQL Server database which he has written the code for that stores all of the pushed notifications.
I have mentioned that it wouldn't be a good idea as it can be prone to hacking etc. He disagrees.
Can any one help with what I need to do? Or does any one know of any tutorials I can follow to help me with this.
One route to take is to make a copy of that Database and put it on the phone as an SQLite Database and have a PHP script that gets the newest additions and adds them to the SQLite database.
A second route you could take, is you could ask him to put it JSON format and you would have a dictionary on the phone that held all of the JSON, and then parse the JSON using apples built in parser, NSJSONSerialization or any of the other JSON parsers out there. Using the parsed JSON, you could then do as you please with the list of notifications
Another method will be for that guy to write a PHP script for you to access all the notifications and you run that in a for loop and populate a table, or whatever, on the phone of the latest push notifications that way. This while take a few seconds longer than needed, depending on how many entries there are.
Ordered according to my preference of options
Since you fairly new to mobile app development I would recommend option 2 for you. It will be a bit more work than choosing option 3, learning curve wise, but it will run faster and be better for you to learn how to parse JSON, as a lot of API's that you come across use that format.
I'm new to iOS Development and am trying to make an application that essentially sorts through a list of 300 names or so. I've got the Drill-Down part of the application down, aside from the detailView, but am now faced with a challenge.
What I would like to do is have users select from 3 fields with a UIPickerView to come up with shorter lists for every time a user is looking for a person. I'd like to use a .plist, but I also have an XML feed of the information. Before I waste all of my time structuring these data sources, does anybody have a good overview as to how I should approach this?
Also, I've asked some this question before, and they tell me to read up on introductory iOS development topics. I understand the mechanics of development, I just can't ever figure out how to approach a task properly. (I'm working on it!)
Thanks in advance. I'd share an image to help clarify, but my rep isn't high enough.
Snip: It looks like I misread your intention which makes my earlier comments irrelevant, you want to have the user select one of 3 options to shrink the list, if I'm not mistaken.
Some more questions for you, so I take it that this XML feed is going to be potentially changing between times that the user loads up the app? Will it only ever grow or are those 300 or so names that are loaded once set for good? The reason I ask so that you can maybe see my train of thought is whether or not using Core Data might be useful. You could easily store your large list locally, save time having to reload this large list frequently, and also you can use the built fetchedObjectController to search your collection of names. I'll keep thinking about it and once you get a chance to answer these questions we can continue.
Ill check back for an edit or comment, and see if I can give you an approach. Also, maybe edit your question with any of your own approach ideas and we could also start from there and refine them if needed.
Edit 2: From the information in the comments this is one of the ways that I could see this being done that make sense to me:
Since you seem to be able to control the information you receive from the feed I would set it up to send you only the contacts that need to be added/removed. You could handle this a few ways depending on your deployment intentions but I would go with the following:
Find a way to signal a first time run of the application, and as a result all contacts would be new, and you could populate your list fully with a slightly longer first time setup. Then any further changes could be quickly handled by smaller edits made to the local list.
You would need to set up Core Data for your application, which should be fairly straightforward in your case, and after this you can use the built in NSFetchRequest to do your searches that will then quickly return a list of narrowed down contacts. As for the physical picker that is just a matter of building the UI which will require some design from your end as you are the only one that knows what you are going for in that regard. Depending on the complexity of your app and what functionality you will want to include you could get away with 1-2 views that simply do the displaying of the contacts in a table and then the picker just reloads when appropriate.
I'm not familiar with the implementation of XML Feeds and receiving data from them, but I have done XML Response parsing into Core Data from a SOAP service before and they shouldn't be terribly different.
Regarding resource to get you started should you need them, I would recommend the following:
eBooks:
http://www.techotopia.com/index.php/Objective-C_2.0_Essentials
http://www.techotopia.com/index.php/IPhone_iOS_4_Development_Essentials_Xcode_4_Edition
Tutorials:
http://www.raywenderlich.com/
The eBooks I have linked are both absolutely fantastic and one of the few xCode 4.0 books that I was able to find that seemed to be of an actual usable quality. They both contain easy to follow and clear tutorials on simple and more advanced aspects of programming for iOS.
Ray's site is an immensely helpful resource as it contains both a very active forum base for iOS programming in addition to a constantly growing tutorial collection as there are 4-5 people that constantly are creating new tutorials that the community votes on and suggests every week. It contains some more advanced topics than the above books and I would recommend looking at it after doing a few walk through/tutorials from the books.
I'll stick around if you have any further questions, otherwise you can send me a notification via these comments, or just post another question and someone is bound to help you out!
-Karoly
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to develop an iphone application that needs an english word dictionary. Can you people suggest me any link from where i can have that database containing a reasonable number of english words with their meanings and example sentence.
Thanks in advance
Update
I recently found out about a much more useful API than wiktionary. It seems google has a "Google Dictionary" that you can use, though it's an unofficial API. Using this query:
http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q={query}&sl=en&tl=en&restrict=pr%2Cde&client=te
You can get a JSON result from google dictionary. Substitute your keyword for {query} (eg q=dog). Apparently this is the dictionary that google docs uses, and possibly some chrome extensions.
Source: Google Operating System (blog)
PS: The comments also mention an API for Dictionary.com.
Previous response
You could access Wikitionary's data via Mediawiki's API. That might be enough for what you need. I don't know of any pre-made dictionaries you could use. If you need spell checking, you might be able to get Aspell working on iPhone.
Links:
Default page for wikionary's api, with a 'quick reference'
Mediawiki's API documentation
There may also be wrappers for the API already created in the language you need. Some are listed on this page.
If that doesn't do it for you, you could try scraping one of the other dictionary websites too.
Edit
I'd probably only try this as a last resort because (as far as I know) you can't get any easily usable results from querying wikitionary. You can get the wiki code for an entry, though. The problem with that is that you'll then have to somehow extract the important information from that code.
For example, take the following query (click to open in your browser):
http://en.wiktionary.org/w/api.php?action=query&titles=dog&prop=revisions&rvprop=content&format=xml
If you read the documentation, you'll see the parts here are action=query, titles=dog, prop=revisions, rvprop=content, and format=xml. These tell the api what you want. It says "I'm performing a query for the entry with title 'dog' and I want the content of the latest revision in xml format".
What you get is:
<api>
<query>
<pages>
<page pageid="24" ns="0" title="dog">
<revisions>
<rev xml:space="preserve">
{{also|DOG|dög}}
==English==
{{wikipedia}}
[[Image:YellowLabradorLooking.jpg|thumb|A dog (a [[Labrador]])]]
... (removed for brevity)
</rev>
</revisions>
</page>
</pages>
</query>
</api>
You'll have to process that somehow.
Anyway, you can create the http request strings yourself, or you can use a wrapper for the api that does the "hard" work of making queries.
I you're looking for an offline paid option, you might want to have a look at lexicontext (full disclosure: it's mine)