简体   繁体   中英

CocoaPods Error (PubNub) with iOS Static Library Project

I'm working on iOS Static Library Project (9.0). I've decided to include PubNub to my Static Library Project. Steps I followed;

  1. I've downloaded PubNub sample project and builded.
  2. I've copied Framework files (CocoaLumberjack and PubNub) into my Supporting Files folder.
  3. I've closed xCode, and created PodFile in project directory.
  4. Content of PodFile is as follows:

    platform :ios, "9.0"

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

    use_frameworks!

    pod "PubNub", "~> 4.0"

  5. After installation i get warning for both Debug and Release says;

[!] The xxxIOSFramework [Debug] target overrides the OTHER_LDFLAGS build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation

  1. I've opened .xcworkspace and saw both my project and Pods project in tree.
  2. At this point build gives error ld: framework not found Pods

After my re-searches, most says that remove Pods.framework which is highlighted in red, and i did.

在此输入图像描述

  1. After removing Pods.framework , build continues to give error such as; ld: -rpath can only be used when creating a dynamic final linked image
  2. I've moved to Target > Build Settings > Other Linker Flags . ObjC was added, and I also added $(inherited) but error still exists.

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? 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. You need to:

  1. Remove added dynamic PubNub and CocoaLumberjack frameworks
  2. Remove !use_framewors from Podfile
  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
  4. Run pod install

This way you should be able to build your own static library with PubNub client code inside.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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