Share links generally longer, generally we have the need to shorten the URL below the paste code to meet the requirements:
nsstring *shareurl =@ "www.example.com";
nsstring *str = [nsstringstringwithformat: @ "http://is.gd/create.php?format=json&url=%@" , Shareurl];
str = [str stringbyaddingpercentescapesusingencoding:nsutf8stringencoding ];
nsurl *url = [nsurlurlwithstring: str];
nsmutableurlrequest *request = [nsmutableurlrequest Requestwithurl: url cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval £ º];
request. HttpMethod = @ "GET" ;
[nsurlconnectionsendasynchronousrequest: request Queue : [nsoperationqueuemainqueue] Completionhandler :^( Nsurlresponse *response, NSData *data, Nserror *connectionerror) {
nserror * error =nil;
nsdictionary *dic = [nsjsonserializationJSONOBJECTWITHDATA:d ata options:nsjsonreadingmutablecontainersError :&error];
NSLog(@ "%@", DIC);
}];
IOS share long URLs to short URLs