MonkeyBonkey
MonkeyBonkey

Reputation: 47881

How to use cocoa pods and the parse sdk without getting linker errors

Following the Parse Quickstart tutorial for "an existing project", I'm adding to a cocoa pods enabled project and I've followed all the steps and I'm getting the following Mach-O Linker errors, mainly around what looks like Twitter and Facebook. So I take it that cocoapods requires the obj-c flag ... which means I need to include the facebook sdk even if I'm not using it. Is there a workaround that doesn't require me to add the facebook sdk while still using cocoapods?

Upvotes: 2

Views: 7653

Answers (3)

Just add the "pod 'Parse'" to your podfile. After that, run the "pod install" at the terminal. Open you XCode project using the xcworkspace created by parse.

Cocoa Pod's Parse library it's in Object C. So you'll need a bridging header file. For shortcut: Go to File > New > File or hit Command+N. Chose a c file and click next. Name it with any name you want.

Xcode asks if you want it to configure a bridging header for you. Chose Yes and Xcode will create a file named something like "-Bridging-Header.h" for you. You can erase the c files you created now, don't need then, you only need the bridging file.

Open it and type #include "Parse.h". With this you can use Parse's SDK in any swift file you want. It will be automatically imported and you don't need to use any flags.

Upvotes: 1

nickbit
nickbit

Reputation: 134

Add the following after

$inherited

to the OTHER_LINKER_FLAGS

-force_load "${SRCROOT}/Pods/Parse/Parse.framework/Parse"

Upvotes: -1

rihekopo
rihekopo

Reputation: 3350

I had the same problem and in my case the best option was to create a new project without CocoaPods. I've read a lot about it, you can add the Facebook SDK to your CocoaPods dependencies or remove the ObjC linkerflag.

Here's the best Stackoverflow answer: Parse for iOS: Errors when trying to run the app

I recommend you to do not use cocoapods, because when i've removed the linkerflag it caused other errors despite it solved the Fb related ones.

Upvotes: 1

Related Questions