MGTwitterEngine - iphone

I am using mgtwitterEngine to integrate twitter functionality.In my application i want response in XML format so i have done all the changes as metion in readme of mgtwiiter
for example i have done
#define YAJL_AVAILABLE 0
in MGTwitterEngineGlobalHeader.h and
#define USE_LIBXML 1
in MGTwitterEngine.m file and i am checking that API_FORMAT is xml too but whenever i am getting response i am getting in json format.
Please can any one tell me what am i missing? any help would be appreciated.
Thaks

Are you looking at NSLog output for received objects? NSLog output for objects like dictionary or array is similar to JSON format.

Related

how to log raw JSON response with RestKit 0.2x

with RestKit 0.2x the RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace); statement displays various mapping info with the returned JSON response but all things are mixed up together which is hard for me to extract the raw JSON body alone.
is there a way to log ONLY the returned JSON body without extra info with it ?
thanks in advance.
You can add a logging code in RKNSJSONSerialization's method
+ (id)objectFromData:(NSData *)data error:(NSError **)error
or better solution would be to subclass RKNSJSONSerialization and add the logging code.
It isn't clear exactly what you're looking for. The trace log does print the entire JSON before the mapping starts.
Alternatively, you could edit RKMapperOperation to do additional logging or just use AFNetworking to download and log the JSON.

Objective C error 3840 - bad JSON apparently but it validates with JSlint

I have read around and this error seems to be from bad JSON. Easy enough, here is my JSON
{"year":"2012","wheels":"Standard","trans":"Unknown"}
My issue is, this appears to be correct, and when I run it through JSON lint it returns vaild. I have also used cURL to download this page and used json_decode() to read it...worked fine.
Here is an example page: http://drivingthenation.com/app/carlist/getVinDtn.php?v=JA3215H1C**M&f=v
I ran it through HTTPScoop and the only thing the response text returned was
{"year":"2012","wheels":"Standard","trans":"Unknown"}
On the objective-c end I am using NSURL and NSData to get the URL, and then NSJSONSerialization. I can print out before NSJSONSerialization and see that it is infact getting data, but this error only occurs when I try to format it into JSON. Any thoughts?
The NSJSONSerialization class, by default, expects the input to be not just valid JSON, but a valid JSON object. If you want to read something that's not an object, you need to specify the NSJSONReadingAllowFragments option to the reader.

iphone : error parsing XML: Unable to read response xml (Error code 5 )

I am using XMLParsing for using my webservice in iphone app.
and i am getting error parsing XML: Unable to read response xml (Error code 5 )
What is wrong?
NSXMLParserPrematureDocumentEndError
The document ended unexpectedly.
Available in Mac OS X v10.3 and later.
Declared in NSXMLParser.h.
The problem looks like your xml is not well formed. So debug on these lines and you will be able to parse the xml successfully.
Check the format of the request u r sending. Or look into this.
http://www.iphonedevsdk.com/forum/iphone-sdk-development/37597-parsing-xml-return-error-code-5-but-url-correct.html
The sixth comment says he has solved the problem.
The following link gives all the error constants
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html

iPhone json parsing problem

When I try to parse ( http://www.roundmenu.com/webservices/index.cfm?ws=listrst&filter=featured ) webservice in json I encounter issues.
If any one can find out what the problem please let me know.
thanks in advance.
That’s not valid JSON. As usual, it’s useful to validate JSON input via http://jsonlint.com.
That particular JSON input fails to properly escape double quotes (\") inside strings.
Put the response in a json formatter like this one on curiousconcept.com. It yields many errors, does look like it's invalid json.

Converting String values to xml

I have some string values that are retrieved from json data. I need a process of converting this strings to xml format and Post it to a url
If it's inside iPhone SDK you will have to parse the string to convert it to XML, unless you can just post the xml as-is.
Anyway. To parse the XML, you have basically two easy options:
NSXMLParser
libxml2 (my preferred choice, don't know why)
Then you can use NSURLConnection class to post the information to the desired XML. There are a lot of Stackoverflow questions already covering this issue you can search and use.
You can also look at an example here.