ios - Is Bolts framework[Parse+Facebook] need to use parse webservice? -
i post question how use bolts framework[facebook+parse] i've question, must use parse webservice if want use bolts-framework?
they provide sample code below related(saveasync:
) parse webservice. i've seen in line "using these libraries not require using parse services. nor require having parse or facebook developer account"
in boltss' github
[[object saveasync:obj] continuewithblock:^id(bftask *task) { if (task.iscancelled) { // save cancelled. } else if (task.error) { // save failed. } else { // object saved successfully. saveresult *saveresult = task.result; } return nil; }];
now confusion, is bolts framework need use parse webservice?
note: don't ask want use bolts-framework. see first line of question.
surely doesn't need parse webservice. i've same difficulty in implementing own task , i'm studying framework. take @ boltstest code: can find useful code.
i'm trying experiments in sample project (https://github.com/giaesp/boltsframeworksample). need define own method returning bftask. here simple excerpt.
- (bftask*) parsehtml:(nsurl*)url searchstring:(nsstring*)searchstring { bftaskcompletionsource * tcs = [bftaskcompletionsource taskcompletionsource]; nsurlrequest * request = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestreloadignoringlocalcachedata timeoutinterval:30]; nsurlresponse * response; nserror * error; nsdata *returndata = [nsurlconnection sendsynchronousrequest:request returningresponse:&response error:&error]; if (!error) { nsstring * receiveddata = [nsstring stringwithutf8string:[returndata bytes]]; nsuinteger occurrences = [self countoccurencesofstring:@"ios" inputstring:receiveddata]; [tcs setresult:[nsnumber numberwithint:occurrences]]; } else { [tcs seterror:error]; } return tcs.task; }
then can use method docs explains , check task status.
[[self parsehtml:[nsurl urlwithstring:@"http://www.stackoverflow.com"]] continuewithblock:^id(bftask *task) { if (task.iscancelled) { // task cancelled } else if (task.error) { // task failed } else { // task completes } return nil; }];
Comments
Post a Comment