简体   繁体   English

iOS静态库项目的CocoaPods错误(PubNub)

[英]CocoaPods Error (PubNub) with iOS Static Library Project

I'm working on iOS Static Library Project (9.0). 我正在开发iOS静态库项目(9.0)。 I've decided to include PubNub to my Static Library Project. 我决定将PubNub包含在我的静态库项目中。 Steps I followed; 我遵循的步骤;

  1. I've downloaded PubNub sample project and builded. 我已经下载了PubNub示例项目并进行了构建。
  2. I've copied Framework files (CocoaLumberjack and PubNub) into my Supporting Files folder. 我已将Framework文件(CocoaLumberjack和PubNub)复制到我的Supporting Files文件夹中。
  3. I've closed xCode, and created PodFile in project directory. 我关闭了xCode,并在项目目录中创建了PodFile。
  4. Content of PodFile is as follows: PodFile的内容如下:

    platform :ios, "9.0" 平台:ios,“9.0”

    source ' https://github.com/CocoaPods/Specs.git ' 来源' https://github.com/CocoaPods/Specs.git '

    use_frameworks! use_frameworks!

    pod "PubNub", "~> 4.0" pod“PubNub”,“〜> 4.0”

  5. After installation i get warning for both Debug and Release says; 安装完成后,我会收到Debug和Release的警告;

[!] The xxxIOSFramework [Debug] target overrides the OTHER_LDFLAGS build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. [!] xxxIOSFramework [Debug]目标覆盖`Pods / Target Support Files / Pods / Pods.debug.xcconfig'中定义的OTHER_LDFLAGS构建设置。 This can lead to problems with the CocoaPods installation 这可能导致CocoaPods安装出现问题

  1. I've opened .xcworkspace and saw both my project and Pods project in tree. 我打开了.xcworkspace并在树中看到了我的项目和Pods项目。
  2. At this point build gives error ld: framework not found Pods 此时构建错误ld: framework not found Pods

After my re-searches, most says that remove Pods.framework which is highlighted in red, and i did. 在我重新搜索之后,大多数人说要删除用红色突出显示的Pods.framework ,我做了。

在此输入图像描述

  1. After removing Pods.framework , build continues to give error such as; 删除Pods.framework ,构建继续给出错误,如; ld: -rpath can only be used when creating a dynamic final linked image
  2. I've moved to Target > Build Settings > Other Linker Flags . 我已经转移到Target > Build Settings > Other Linker Flags ObjC was added, and I also added $(inherited) but error still exists. 添加了ObjC ,我还添加了$(inherited)但错误仍然存​​在。

Anyone have any idea about getting -rpath can only be used when creating a dynamic final linked image error while adding Cocoapods to iOS Static Library Project? 任何人都知道获取-rpath can only be used when creating a dynamic final linked image错误时使用,同时将Cocoapods添加到iOS静态库项目? I can provide additional information if you need. 如果需要,我可以提供更多信息。

Thank you. 谢谢。

Getting started describes few integration ways and from your question it looks like you used bot of them at once. 入门介绍了几种集成方式,从您的问题来看,您似乎一次使用了它们的机器人。
If you want to build own static library and integrate PubNub and CocoaLumberjack in it, you should stick to pure CocoaPods approach. 如果你想构建自己的静态库并在其中集成PubNubCocoaLumberjack ,你应该坚持使用纯CocoaPods方法。 You need to: 你需要:

  1. Remove added dynamic PubNub and CocoaLumberjack frameworks 删除添加的动态PubNubCocoaLumberjack框架
  2. Remove !use_framewors from Podfile Podfile中删除 use_framewors
  3. Clean up a bit (if you have deintegrate plugin installed for CocoaPods you can call it) by removing workspace, Pods folder and Podfile.lock 通过删除工作空间,Pods文件夹和Podfile.lock来清理一下(如果你为CocoaPods安装了deintegrate插件,你可以调用它)
  4. Run pod install 运行pod install

This way you should be able to build your own static library with PubNub client code inside. 这样你就可以在里面用PubNub客户端代码构建自己的静态库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM