Connect to twitter API using SSL in iOS -
i'm trying user's twitter timeline using twitter api in ios sdk , got error saying:
code = 92; message = "ssl required";
i googled error , found this page on twitter api website, have no idea how use in ios.
here's code:
acaccountstore *account = [[acaccountstore alloc] init]; acaccounttype *accounttype = [account accounttypewithaccounttypeidentifier:acaccounttypeidentifiertwitter]; [account requestaccesstoaccountswithtype:accounttype options:nil completion:^(bool granted, nserror *error) { if (granted == yes){ nsarray *arrayofaccounts = [account accountswithaccounttype:accounttype]; if ([arrayofaccounts count] > 0) { acaccount *twitteraccount = [arrayofaccounts lastobject]; nsurl *requestapi = [nsurl urlwithstring:@"http://api.twitter.com/1.1/statuses/user_timeline.json"]; nsmutabledictionary *parameters = [[nsmutabledictionary alloc] init]; [parameters setobject:@"100" forkey:@"count"]; [parameters setobject:@"1" forkey:@"include_entities"]; slrequest *posts = [slrequest requestforservicetype:slservicetypetwitter requestmethod:slrequestmethodget url:requestapi parameters:parameters]; posts.account = twitteraccount; [posts performrequestwithhandler: ^(nsdata *response, nshttpurlresponse *urlresponse, nserror *error) { // nsjsonserialization class used parse data returned , assign our array. array = [nsjsonserialization jsonobjectwithdata:response options:nsjsonreadingmutableleaves error:&error]; if (array.count != 0) { dispatch_async(dispatch_get_main_queue(), ^{ nslog(@"%@",array); }); } }]; } } else { // handle failure account access nslog(@"%@", [error localizeddescription]); } }];
is there way solve problem?
use "https" in url:
https://api.twitter.com/1.1/statuses/user_timeline.json
docs: https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
Comments
Post a Comment