开发者

Erply Inventory API development for IPAD and http post queries to server

I want to 开发者_Go百科develop point-of-sale application for IPAD using InventoryAPI. I know that Erply has a made their own IPAD POS, but I have thoughts to make it little different.

Has anybody used this InventoryAPI and is it simple to use? Ok, my question is that how can I send http queries to server and get response with Cocoa. I'm just starting to learn this and if anyone can point me to some useful link or topic which covers sending http queries, I'll be grateful.


There might be an SDK, but if there isn't, you get to learn something new and that's a good thing.

In general, the way you're going to interact with a web-based API is with the NSURLConnection object and it's delegate, NSURLConnectionDelegate.

Have a class that builds a URL, URL Request, and then does the connection. Then you'll create an NSObject subclass, make it conform to the NSURLConnectionDelegate protocol (this is the connection delegate), and implement 4 delegate methods (this is all covered in the class reference). When you've pulled the data down from the server, in your connectionDidFinish method, convert/parse the data and post the resulting object in a notification to a view controller or whatever.

Also, if it's OAuth based, you'll need to write some kind of token manager class, which is basically the same thing... except you'll need to write in handling for different HTTP response codes so the user doesn't need to worry about expired tokens and the like.

Anyways, I'd be happy give more detail... Cocoa actually makes handling this sort of things really simple.

Oh... does this API you're working with do JSON or is it XML? Either way, try and avoid NSXMLParser for now... it's a headache, especially when you just want to get something up and running. (though it's handy to know in general) There are a few really good open-source libraries for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜