2

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.

enter image description here

  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.

6
  • 1
    If you added CocoaLumberjack and PubNub dynamic frameworks directly (don't forget to add them to embedded binaries), why you tried to integrate them with CocoaPods later? Commented Nov 17, 2015 at 19:06
  • 1
    @moonlight I've followed steps at PubNub's Getting Started page. Step by step they say integrate PubNub to a normal project like my steps. With normal project it works. But while trying to integrate with Static Library Project, these errors occurs... Commented Nov 18, 2015 at 9:46
  • 1
    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 (remove dynamic frameworks from your project and remove !use_framewors if specified in Podfile). Commented Nov 18, 2015 at 14:01
  • 1
    @moonlight I've tried your suggestion. First; build gave 'library not found for -lPods'. When I remove that file from Frameworks folder, it works fine.. I want to ask; When i type #import "PubNub/PubNub.h" it works fine, but why it doesn't come with intellisense? I have to type as hardcoded. After typing that, i am able to reach classes in PubNub. Commented Nov 18, 2015 at 14:10
  • 1
    @moonlight btw please write your 2nd comment as an answer. I will Vote Up and Accept as an answer. Thank you. Commented Nov 18, 2015 at 14:14

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.