I’m working on the script in objective-c.
I created a “Command Line Tool” in xcode and I want to request a JSON web service.
In my previous iPhone apps I use to import ASIHTTPRequest framework. Unfortunetly this framework use UIKit library.
I don’t want to import this library and all these dependencies.
Do you know a good framework or library that I can use in my Command Line Tool application ?
Thanks.
ASIHTTPRequest shouldn’t require UIKit. You should be able to remove that if it’s there. You can’t import UIKit into a Mac app anyway.
The ASI framework has been discontinued, though. You may want to look at other options such as MKNetworkKit and AFNetworking. Both should work fine in a commandline app.
EDIT: Don’t forget that most frameworks like this will require a run loop. The typical way to manage that in a commandline app looks like this (from NSRunLoop docs):
This is an infinite loop until something sets
shouldKeepRunning.You can also use
NSApplicationas shown in Run NSRunLoop in a Cocoa command-line program.