0

1)I have did all steps given at Pinterest developer site here

2)This is my pod file

 # Uncomment this line to define a global platform for your project
     platform :ios, ‘7.0’
    # Uncomment this line if you're using Swift
    # use_frameworks!

    target 'xyz.com' do
    pod "PinterestSDK", :git => "https://github.com/pinterest/ios-pdk.git"
    end
   target 'xyz.comTests' do

    end

3)When I run without #import "PDKPin.h" & following code

[PDKPin pinWithImageURL:[NSURL URLWithString:imageUrl]
                       link:[NSURL URLWithString:shareUrl]
         suggestedBoardName:@""
                       note:productName
                withSuccess:^
     {
         NSLog(@"Succesful to pin");

     }
                 andFailure:^(NSError *error)
     {
         NSLog(@"Failed to pin");
     }];

it runs without error

4)But when I add the above code it gives linker error

enter image description here

Edit: I have tried it in blank project it works fine. But I am unable to figure out what all the dependencies still there in old project.

Rohit Pradhan
  • 3,867
  • 1
  • 21
  • 29
  • I think @BraveS answer in here may can help http://stackoverflow.com/questions/18408531/xcode-build-failure-undefined-symbols-for-architecture-x86-64 – fray88 Jan 06 '16 at 14:12
  • As I am using pods I don't think I need to add it explicitly.. – Rohit Pradhan Jan 06 '16 at 14:17

2 Answers2

0

Start Fresh

Use Xcode 7.1+, create a new project, run pod install:

target 'SO-34633492' do
    pod "PinterestSDK", :git => "https://github.com/pinterest/ios-pdk.git"
end

You probably have inconsistencies in your existing project ; while figuring out what is wrong may be enlightening, may I suggest starting on a clean slate.

Must include headers

You cannot compile your .m without including #import <PDKPin.h>:

~/SO-34633492/SO-34633492/ViewController.m:21:6: Use of undeclared identifier 'PDKPin'

This does work:

#import <PDKPin.h>
NSString * imageUrl = @"";
NSString * shareUrl = @"";
NSString * productName = @"";

[PDKPin pinWithImageURL:[NSURL URLWithString:imageUrl]
                   link:[NSURL URLWithString:shareUrl]
     suggestedBoardName:@""
                   note:productName
            withSuccess:^
 {
     NSLog(@"Succesful to pin");
 }
             andFailure:^(NSError *error)
 {
     NSLog(@"Failed to pin");
 }];

Things that may have gone wrong

Community
  • 1
  • 1
SwiftArchitect
  • 47,376
  • 28
  • 140
  • 179
  • Thank you for reply . I already tried it in new project & It works smoothly.I forgot to mention it in my question. But,my problem is I have to implement it in existing project.Please suggest any workout. – Rohit Pradhan Jan 15 '16 at 10:14
  • This may be a different question. My answer shows that it works as designed. You may need to compare a fresh project to the existing broken one. +1 ? – SwiftArchitect Jan 15 '16 at 18:53
  • Use the new project to compare the settings. You may have mismatch or conflicting settings. If you are not encountering errors with my answer, please consider √ and +1. – SwiftArchitect Jan 26 '16 at 17:29
  • I have created new project and compared the settings.Not found any difference,Can you guide which settings may have the problems.You can specify it in answer – Rohit Pradhan Jan 26 '16 at 17:35
  • Thanks for supporting me .I found the solution for my issue.I have added in my answer. – Rohit Pradhan Feb 03 '16 at 12:32
0

After a long search & tries I have found the following solution

  1. I have changed the target's build settings in the other linker flags section. I have added the flag $(inherited) in other linker flags

enter image description here

Rohit Pradhan
  • 3,867
  • 1
  • 21
  • 29
  • That inherited should have been automatic (created by the `pod install` scripts). Try this: make a backup-copy of your current `.xcworkspace`. Run `rm -rf Pods/ Podfile.lock ; pod install`. This will create a new `.xcworkspace`, which should have the `$(inherited)` flag. Great you found it. – SwiftArchitect Feb 03 '16 at 16:06