How to specify which JSON library for AFNetwork - ios

For the AFNetwork , it provides ability to choose several JSON open source library, like
AFNetworking uses NSJSONSerialization if it is available. If your app targets a platform where this class is not available you can include one of the following JSON libraries to your project for AFNetworking to automatically detect and use.
JSONKit
SBJson
YAJL
NextiveJson
My question is how to speicify the JSON library with code or configuration instead of automatical way.

For using the native iOS JSON API, just code like this in the .pch file
define _AFNETWORKING_PREFER_NSJSONSERIALIZATION_ 1

Related

Data Serialisation in Objective-C (Avro alternative)

I've been the last week trying to serialise all of the classes of one iOS project (Objective-C).
Due to I use to do it in Android projects with Avro (Apache) library, I've been trying to do the same in the iOS project, however, the first thing that I noticed is that there is not too much information about Avro in iOS.
First thing I tried:
Implement the library ObjectiveAvro using CocoaPods but some classes in the library Avro C were not found when imported.
Second thing I tried:
Remove and do again the previous process but this time only with the Avro C library but the same error appeared.
Third thing I tried:
Implement BlueSteel framework using Carthage. This is a swift library but I wanted to try if I could use it somehow in an Objective-C project. I couldn't.
I just need to serialise and deserialise data providing a schema as you can do with Avro (Android) in an Objective-C project and the last thing that I want to do is convert the whole project to Swift.
So do you know what's the current way to do that in Objective-C?
I could figure it out how to do the Third thing I tried:
Basically, it's necessary to import the library through Carthage, then create a new Swift class which is the one that is going to "talk" with the Swift library, due to we are in an Objective-C project. XCode will ask you to add a "header-class" and press "yes".
Then it's as simple as using the Swift to call the library methods and call the Swift class from the current classes. Swift class in Objective-C project
Finally just to inform that the BlueSteel framework is a nightmare due to is really limited and really poor documented therefore I still don't know a real alternative.
However, if you're going to use it, have in mind that the classes are not autogenerated so you need to do manually the conversion to Avro and sign results.

Parse protobuf file in iOS applicaiton

I am getting data file in the format of .proto, I am confronting this type of parsing for the first time. Could you please suggest how we can parse .proto file in the iOS app. I am very new with a protobuf file.
I am able to handle protoBuf formate data. I have used Swift Protobuf swift library for it. This is really a great library, it has awesome documentation. I am adding a reference here. https://github.com/apple/swift-protobuf

Static version of parse library

Not sure why it is down voted? If the person can provide me a reason, I will try to correct?
Does parse (parse.com) provide a static version of parse IOS library?
We want to statically link parse to our proprietary (static) library and by that way our library users will not be troubled with the requirement of adding the parse SDK libraries etc.
Kindly provide information as whether it is possible to completely hide parse inside our library?
Thanks
Parse.com does not provide static libraries.
You can compile a custom static library that includes the parse.com SDK, but I would not recommend it. Parse probably does not want you rolling their code into an obfuscated version and would prefer to keep the linking process in place. Parse updates their API and SDK regularly, and your static library would have to be updated to match each time.

ios static library issue (skip sbjson library code from static library of ios)

I am creating a static library in ios. which uses sbjson parser 3rd party library and things are working fine. if we only use ABC.a library in any other project.
The the problem arises when we include DEF.a libary of any other project which internally uses Sbjson parser.
So, my query is that how can we skip building 3rd party libray like sbjson, afnetworking etc. with my ABC.a library.
Any help will be usefull.
I have got solution for the problem
below url mite help all
http://twobitlabs.com/2012/01/excluding-files-from-production-xcode-builds/

How to write to an XML file from iOS?

I am developing an app for iPad, and I need to modify several attributes in a XML file at runtime.
I found the class NSXMLDocument. But I haven't been able to import it to my project.
Is this class not available for iPhone/iPad development?
Is there some other approach I can consider?
I read about libxml library. Is it my answer or there is a better approach?
NSXMLDocument is MacOS X Cocoa only. You have available on iPhone NSXMLParser, and several external libraries built on libxml2 - TouchXML, KissXML and a couple of others.
Note that KissXML supports writing XML.
Other XML libraries that have been suggested include the XML support from Google Data and VTD-XML.
You are looking for a DOM XML parser, which is best for modification of XML documents. See for example this tutorial - without mapping to and from Model Objects - use the XPath.

Resources