objective c - How to share image in Pinterest using latest iOS SDK -
i want share image in pinterest. have configured pinterest ios sdk without cocoapods.
i have written code making me redirect pinterest app , getting authorisation. after didn't response.
in previous version of ios sdk, have pass url of image. asking board id also.
i don't know how board id , share image in pinterest since not getting response success block.
this code using.
[[pdkclient sharedinstance] authenticatewithpermissions:[nsarray arraywithobjects:pdkclientreadpublicpermissions, nil] withsuccess:^(pdkresponseobject *responseobject) { nslog(@"response object:%@",responseobject); } andfailure:^(nserror *error) { nslog(@"error:%@",error); }];
i trying past 1 week. please suggest me doing mistakes.
thank you.
i solved issue , thank people helped me. now, can share image in pinterest. have referred example app github link https://github.com/pinterest/ios-pdk share image in pinterest. here steps followed.
1) installed pinterest sdk using cocoapods.
2) have added below line in didfinishlaunchingwithoptions
[pdkclient configuresharedinstancewithappid:@"1234566"];
3) have added below 2 functions in appdelegate.m file
- (bool)application:(uiapplication *)application handleopenurl:(nsurl *)url { return [[pdkclient sharedinstance] handlecallbackurl:url]; } - (bool)application:(uiapplication *)app openurl:(nsurl *)url options:(nsdictionary *)options { return [[pdkclient sharedinstance] handlecallbackurl:url]; }
4) have added below code in image share button action.
[pdkpin pinwithimageurl:[nsurl urlwithstring:@"https://about.pinterest.com/sites/about/files/logo.jpg"] link:[nsurl urlwithstring:@"https://www.pinterest.com"] suggestedboardname:@"testing" note:@"the pinterest logo" withsuccess:^ { // weakself.resultlabel.text = [nsstring stringwithformat:@"successfully pinned pin"]; } andfailure:^(nserror *error) { //weakself.resultlabel.text = @"pin failed"; nslog(@"error:%@",error); }];
Comments
Post a Comment