I solved this problem and I would like to thank the people who helped me. Now I can share the image on Pinterest. I gave an example application from this Github link https://github.com/pinterest/ios-pdk to share the image on Pinterest. Here are the steps I followed.
1) I installed the Pinterest SDK using Cocoapods.
2) I added the line below to didFinishLaunchingWithOptions
[PDKClient configureSharedInstanceWithAppId:@"1234566"];
3) I added the following two functions to the 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) I added the code below to the action of the image sharing button.
[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 it failed"; NSLog(@"Error:%@",error); }];
source share