Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 通过CoCoapod添加Pinterest链接器时出错_Ios_Objective C_Cocoapods_Pinterest - Fatal编程技术网

Ios 通过CoCoapod添加Pinterest链接器时出错

Ios 通过CoCoapod添加Pinterest链接器时出错,ios,objective-c,cocoapods,pinterest,Ios,Objective C,Cocoapods,Pinterest,1) 我已经完成了Pinterest开发者网站给出的所有步骤 2) 这是我的pod文件 # 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 "Pinteres

1) 我已经完成了Pinterest开发者网站给出的所有步骤

2) 这是我的pod文件

 # 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) 当我在没有的情况下运行时#导入“PDKPin.h”&以下代码

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

     }
                 andFailure:^(NSError *error)
     {
         NSLog(@"Failed to pin");
     }];
它运行时不会出错

4) 但是当我添加上面的代码时,它给出了链接器错误

编辑:我在空白项目中试用过,效果很好。但我不能 找出旧项目中仍然存在的所有依赖项

重新开始 使用Xcode 7.1+,创建一个新项目,运行pod安装:

target 'SO-34633492' do
    pod "PinterestSDK", :git => "https://github.com/pinterest/ios-pdk.git"
end
您的现有项目中可能存在不一致之处;虽然找出问题所在可能会有所启发,但我建议从头开始

必须包含标题

如果不包含导入,则无法编译
.m

~/SO-34633492/SO-34633492/ViewController.m:21:6:使用未声明的标识符“PDKPin”

可以工作:

#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");
 }];
#导入
NSString*imageUrl=@;
NSString*shareUrl=@;
NSString*productName=@;
[PDKPin pinWithImageURL:[NSURL URLWithString:imageUrl]
链接:[nsurlUrlWithString:shareUrl]
建议的板名:@“”
注意:productName
如果成功:^
{
NSLog(@“成功锁定”);
}
andFailure:^(N错误*错误)
{
NSLog(@“未能锁定”);
}];

可能出错的事情

  • 比较您的项目:
  • 删除派生数据:
  • 找不到库:
  • 配置错误:
  • 阅读更多:

经过长时间的搜索和尝试 我找到了以下解决方案

  • 我已在中更改了目标的生成设置 另一个链接器标志部分。 我在其他链接器标志中添加了标志$(继承)

  • 我认为@BraveS Response在这里可能会有所帮助,因为我正在使用pods,我不认为我需要明确添加它。谢谢您的回复。我已经在新项目中试过了&它工作得很顺利。我忘了在我的问题中提到它。但是,我的问题是我必须在现有的项目中实施它。请建议任何训练。这可能是一个不同的问题。我的回答表明它按设计工作。您可能需要将新项目与现有的已断开项目进行比较+1?使用新项目比较设置。您可能有不匹配或冲突的设置。如果您没有遇到我的答案错误,请考虑√ 和+1。我已经创建了新项目并比较了设置。没有发现任何差异,您可以指导哪些设置可能存在问题。您可以在回答中指定。感谢您的支持。我找到了问题的解决方案。我已经在回答中添加了。这应该是自动的(由
    pod安装
    脚本创建)。尝试以下操作:制作当前
    .xcworkspace
    的备份副本。运行
    rm-rf Pods/Podfile.lock;pod安装
    。这将创建一个新的
    .xcworkspace
    ,它应该具有
    $(继承)
    标志。很好,你找到了。