http://imasters.com.br/artigo/22804/ios/trabalhando-com-json-em-aplicacoes-iphone follow this tutorial to read a JSON in my application, and works correctly except when there is not a connection to the internet .
If you have a failure during the process for applying it in time to read the JSON, sometimes when connected to WIFI iPhone takes a while to get IP if I access the application at this time also breaks the application.
How can I identify it to fix the error?
There are various ways to resolve this issue:
1: Put a check if the data is a valid JSON before you parse it.
2: Set a JSON at client end for handling Errors i.e. create a json when you receive error from network connection. & load that JSON to parse and return that JSON. So if you don't get Server response, You can give your JSON to parse.
Hope it helps.
You could use a Reacability class to make sure that you are able to connect to the website before making any requests for the JSON.
You could also use AFJSONRequestOperation which is a part of AFNetworking that is very good with error checking and won't parse invalid JSON.
Related
I have a CSV report where I have to send the report using FIX protocol to the counterparty.
I tried using quickfixj ,but was not able to send a logon.
Session.sendToTarget is returning false .as well I see in the events logs:created session no responder ..resetting session.Could you please advice what is going wrong?
Also want to know how is the data dictionary being read when we set it as true in the config file using quickfixj.
Well this is rather a big question. You've got to configure QuickFix to connect to your counterparty. You've got to implement the QuickFix Application with which you'd transfer your CSV data to FIX message key value pairs.
The thing to do is look at the example application, Banzai
You use the config file to set the location for the data dictionary you use
I have to download 100 thousand JSONS, each JSON not more than 200 characters. I am using AF networking. Is there a way to encode to reduce the size at the server side and send and i should be able to decode at iPhone side.
Moreover has anyone got a method to download the JSONS and store it in the DB on the background thread.Because when i do that directly the UI thread is blocked. Sample Code would be really helpful.
Need the best way to download the HUGE-JSON and store it in the DB.Thanks!
For encoding you can, for example, use gzip-compressed data in your http response that will be unpacked by ios automatically without the need to code anything. Just add "Content-Encoding: gzip" to your http response on the server side. On iOS, i think NSURLRequest accepts gzip encoding by default, or you can set
[request setValue:#"gzip" forHTTPHeaderField:#"Accept-Encoding"]
Of course you can download the JSONS in the background. A good source for information and example code is here http://iosdevelopmentjournal.com/blog/2013/01/27/running-network-requests-in-the-background/
First time posting a question. I'm trying to call some SOAP webservices from inside a blackberry app using the ksoap2 library. I've successfully managed to get a response from the one service, which uses an HTTP url, but now that I'm trying to get response from a (different) HTTPS url, I've run up against a brick wall.
The response dump I'm getting has the following fault message:
"An error occurred while routing the message for element value : (country option I specified in my request). Keep-Alive and Close may not be set using this property. Parameter name: value."
The weird thing is that using Oxygen XML's SOAP tools with the XML request dump works just fine. Any ideas where to start looking? This has taken up a full day already.
Update:
Responding to your comment below - it turns out the double quoting is part of the SOAP spec. Some servers are more relaxed in their implementation, and will work without the quotes.
ksoap2 doesn't force the quotes onto your actions - you may want to patch your ksoap2 library to ensure the quotes are always there.
ymmv
Original:
I don't think this is a SOAP related problem, nor with BlackBerry.
I think the problem lies on the server side, since that error string is not a common error (just google it to see no hits on the whole internet other than this question).
Looks like this is a job for the network guy on the server side to tell you what he's seeing on his end.
Only other thing I can think of is to make the call using HTTP instead of HTTPS. You can then use some network sniffer to see what the difference between the messages is. Alternatively, install an SSL proxy with something like "Charles" and sniff the packets like that.
I am sending a request back to the server I am communicating with, the gist of this request will have a bunch of different parameters, like user ID, request number etc.
One of the more important parts of the request is a segment of XML that im hoping to create based of a few user selections in my interface.
Then at the end i will wrap this all up and send it off to the server...
However at the moment I have no idea how to form an segment xml, I have been reading this but im not sure how it relates to what I would like to do.
any help, example code, example tutorials or anything would be really helpful.
A plist is just xml with a strict dtd; and you can use NSPropertyListSerialization to create one to send back to the server from an NSArray/NSDictionary, very easily.
I have an app to send data from iPhone to MySQL server and I got it with request from objective-c and php on server.
Now, I want to receive data from server by XML. I have created a php code to generate data from MySQL to XML. How can I code in objective-c to call this php code? The goal is using this XML to parse and display on iPhone (I have objective-c code to parse xml file from link on server).
Please help me if you know and used to work on that.
Use Web-servces Like XML- RPC, SOAP ,REST
To connect to a mysql database, your best bet is to use JSON/SOAP/XML/PHP or some combo of the mentioned, to talk between your database and your app..
The reason database connection directly from the device is a bad idea, is that you have to enable global external access to it for it to work. You can keep your data safer by having scripts on your server do the communication to the database.
Your server needs to expose a service of some kind (a URL the iPhone app can call).
Your app can call this URL with NSURLConnection (or lots of others).
This will return you an NSData * object.
Your app will then need to parse this raw data into XML (or JSON or a few others). You can use NSXMLParser (and lots of others) to do the parsing.
Then, you need to translate the XML into useful business objects.