JSON iphone help desperately needed - iphone

Hi desperate newbie in need of direction! Well I say newbie, I have almost built myself the app I set out to achieve, a tableview to display story titles from my website, that when touched using the navigation controller slides to the story/article.
Only problem is that I only have test data that is embedded into my views as an array (which is no good to me). I need this data to come from my website, www.theknowledgeoflondon.com. I want to take the title to display in the tableview and then when touch it slide to the actual article.
Been reading up and believe that JSON could be the answer or XML? I do not have a clue on this subject and if I thought learning object c and coco touch was hard this JSON OR XML thing seems to be a new world of PAIN for me!!! and there doesn’t seem to be anything by way of good tutorials out there for someone that has not a clue on the subject. My data is drawn from a simple MySql table from a php script and was hoping there is an easy way to feed this into my table view?
Would be very greatful for any information on a good way forward. Have already downloaded SBJson, but then read that JSONTouch is a good alternative to use. Or should I be using straight XML. Any help and good tutorials would be much appriciated.
Thanks you in advance.
Steve

I made an app last week that uses XML and I found it the easier way of doing what you want to do. But I found an awesome tutorial that I believe is perfect for what you are trying to do. It helps you create the web service needed and teaches you how to access the data that you wish to access.
http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app
and also check
http://www.raywenderlich.com/2965/how-to-write-an-ios-app-that-uses-a-web-service
And for even more information on web related subjects also have a look at www.w3schools.com it is an amazing website dedicated to teach about web technologies such as XML and the like.
Hope it helps you as much as it has helped me.

If you have the option to choose then I will suggest to use plist format. Open a plist file with a plain text editor. You will find that that is actually a XML file. The big advantage of using plist is that you don't need another parser. You can convert a plist file directly to NSArray using arrayWithContentsOfFile or arrayWithContentsOfURL or convert them directly to NSDictionary by using similar methods. And you can create them using plist editor of Mac easily.

Related

write to JSON Beginner

I need to find a good tutorial that would guide me to write to a JSON file. and also to read from a JSON file and populate core-data with it.
I have googled for days, and couldn't find a good tutorial. Can someone give me a sample code or point me to a good tutorial. I am new to objective-c
to introduce the structure of JSON, http://json.org/
and if you scroll down, you will find links to several open-source (which you can use as examples) projects which implement JSON serializing and deserializing. basically, there, you will find much more code examples in their projects than anyone here can ever really post as a response to your question.

Add a signature image to a pdf in iOS for the iPhone/iPad in particular

With the iOS support for Quartz 2D and its support for the PDF format; should adding a signature image to a pdf be a little easier. I have looked all over and saw people are using the PDFKit, UIView or Core Graphic Library. Which is the easiest and the recommended library for the effort? Also, are there simple examples of the recommend library. When I tried to see how Quartz 2D worked, all I could find are narrative explanations about how it worked and specific method you may use but no complete examples. You know the hello world one. Anyway, I am new to iOS development but been writing code for over 20 years so I might be able to pick this OS up as well.
Can some poor soul have pity on me and please point me in the right direction?
I have done this by loading the old pdf file on view and then add signature on that view and then render the view. check the following post
Add a signature image to a pdf without showing the pdf data to user in iOS
But not able create the pdf which contain existing pdf with signature "without showing on view" .
It's too late to answer this question now. But let me just provide some pointers for people who may bump into this question in future.
This one summarizes PDF handling in iOS pretty well. Good for starters.
http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/#more-242
This one is also similar, but not very exhaustive. http://www.absoluteripple.com/1/post/2012/03/generating-pdf-in-ios.html
The above links do not talk about handling existing PDFs. I found this stackoverflow answer really useful for that.
Add pdf page to an existing pdf objective-c
Just a note, if you want manipulate existing PDFs, Quartz 2d is the way to go.
Also look at reference pages of CGPDFDocument, CGPDFPage, CGPDFContext and CGContext.

XML Parsing of Multiline tags

I am using XML Parsing in one of my apps. I have not done this before but I observed something weird (or may be now) today. I am trying to locate a business on in my app and their googlemaps link is obviously big
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=1001+Fannin+Street,+Houston,+TX&aq=0&sll=37.0625,-95.677068&sspn=36.999937,73.476563&ie=UTF8&hq=&hnear=1001+Fannin+St,+Houston,+Harris,+Texas+77002&z=16.
Every time I load using this link the app crashes. However if I change the link to something like :
http://maps.google.com/?saddr=0000+FM+0000+RD+Houston+TX+77000
the app loads perfectly and works perfect.
I know this is not a problem in my app as I am using this just for reference to something else and not loading the addr in google maps app (as this works with the big link). So I am concluding that there is something wrong in the way I am writing it in my XML.
Please do not direct me to any tools and stuff that shorten the link etc. as I dont want to get in to that. I am sure that I am messing up somewhere in my basics so if some1 tells me what are the basics behind this.
Thank you,
Well if the top link is in XML and hasn't had its ampersands escaped you'll not have well formed XML.
& should be escaped as &

Any examples/tutorials on using GData spreadsheets with gdata-objectivec-client?

I need to update some cells in google doc spreadsheet on iPhone app.
I've downloaded GData source and example projects (not iphone specific) but I can't seem to get it to work. Does anybody know of any good (or any at all ;)) tutorials out there?
Best regards.
The file SpreadsheetTableSampleWindowController.m has examples of using tables and records in spreadsheets. The method randomizeSelectedTable shows how to fill cells with randomly-selected strings.
Have you looked at the introduction? Or maybe you could post the error message your getting or the problem your running into.

Possible to parse this html with xpath?

I am working on gather sports statistics for a personal hobby project. I found this site with all the info I need:file:///Users/JohnJNichols4/Desktop/view-source%20cluster.leaguestat.com%20download.php%20client_code=ahl&file_path=daily-report%20daily-report.html
Am I able to parse this site with xpath? I only have experience (little experience) with cocoa and xcode, so I am writing this is objective c with a wrapper called hpple. My problem arises when I need to pull info from the tables. I have no idea how to go about this. The xpath expressions that I enter are all wrong. Can anyone show me how one might parse the standings in the first table? The function I am using is:
NSArray *elements = [xpathParser search:#"xpath stuff goes here"];
Thanks a lot!
EDIT URL
Sorry guys, I put up the local URL by mistake. Here is the right one: http://cluster.leaguestat.com/download.php?client_code=ahl&file_path=daily-report/daily-report.html
If you want to treat it as XML, you can, but it'll have to be properly formed, which isn't always the case with HTML. I'd recommend using the TouchXML library, it has great xpath support and a fair amount of documentation and examples.
http://foobarpig.com/iphone/touchxml-installation-guide.html