Avoid writing background code, but to ensure that the app can have backstage, using AVOs this product to help their own app networking, AVOs is a very powerful cloud service, the basic principle and the same as parse, but the parse in foreign countries may be a bit limited to the speed of domestic users.
The following code directly, is a test of the purpose to detect the API and networking speed, and so on.
As long as the data is stored and read.
Equivalent to feeling in the operation of a local database, very convenient, can quickly develop the app.
//avostestvar avobjetctest:avobject = Avobject (className:"Testobject") avobjetctest["Test"]="test2"//inside the bracket is the key to the right is valueAvobjetctest.setobject (NSNumber (int:345), Forkey:"123") Avobjetctest.save ()//This can actually be stored in the background to prevent the main thread from blocking println (Avobjetctest.objectid+"") var avq:avquery= Avquery (className:"Testobject") //avquery *query=[avquery querywithclassname:@ "Testobject"]//Here is the OC code inside the official documentAvq.wherekey ("Test", Equalto:"test2") Avq.findobjectsinbackgroundwithblock {(objects, er)-Voidinch//Closedpackage here and the official guide is a little different, the left objects here is an object collection type, and the official guide is the Nsarray type, where the specified type is not compiled, and GitHub above the example is not specified type, I can just transform it into a nsarray . if(Er = =Nil) {println ("#count #", Objects.count) var testarray:nsarray=Objects println (testarray) forObjinchTestarray {var aobj:avobject= obj asavobject println (aobj)}}Else{println (er.userinfo)}}
Too much print, just easy to look at the results, of course, need to operate cocoapods to join the class library, and set up a good swift call OC.
[Ios]swift uses AVOs's API