I'm trying to use a Phonegap with cocoapods. Phonegap already has issues compiling from command line so I'm just using Xcode with the generated project file (and assumably I'd have to do that anyway when using cocoapods).
I've pushed up on Github a reproduced empty project with my problem: https://github.com/Dan2552/phonegap-reproducable-issue
You can see the steps I made after making a plain brand-new Phonegap app in the build_ios
script in the root directory on the repo. But I've also pushed up the generated project files (platforms/ios) so anybody without Phonegap should be able to open the project.
I'm having a weird issue with compiling. Probably issues with the pre-bundled Cordova library and cocoapods.
When building without doing anything after generating the project with Phonegap and adding in the cocoapods, I get the following errors:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_OTPublisher", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
"_OBJC_CLASS_$_OTSession", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
"_OBJC_CLASS_$_OTSubscriber", referenced from:
objc-class-ref in libPods.a(OpenTokPlugin.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Cocoapods warns:
[!] The target
HelloWorld [Debug]
overrides theOTHER_LDFLAGS
build setting defined in `Pods/Pods.xcconfig'.[!] The target
HelloWorld [Debug - Release]
overrides theOTHER_LDFLAGS
build setting defined in `Pods/Pods.xcconfig'.
and therefore I tried deleting the OTHER_LDFLAGS
('Other Linker Flags' in Xcode) entry altogether. This successfully compiles on an iOS device, but not on the simulator, nor will the project build on archive.
Building for simulator will get the same error as before (Undefined symbols for architecture
)
Building for archive will get
/Users/dan2552/projects/ReproducableProblems/OpenTokPhonegap/Classes/OpentokPlugin.h:9:9: 'Cordova/CDVPlugin.h' file not found
I've also tried putting $(inherited)
in the OTHER_LDFLAGS
which produces the same results as deleting them.
You can do that by switching customLib.a's base SDK to iOS and then building a simulator binary. I suspect that the root cause of this that customLib.a is configured to try to create a single library that can be included in macOS, iOS and iOS simulator projects by including artifacts for each platform as different slices.
It is not enabled by default on the simulator builds to speed up the build time while debugging. However since it produces smaller applications it can speed up AOT compilation and uploading to the device, all devices (Release) builds are using the linker by default.
Disabling linking will make sure that no assemblies are modified. For performance reasons this is the default setting when your IDE targets for the iOS simulator. For devices builds this should only be used as a workaround whenever the linker contains a bug that prevents your application to run.
The linking process can be customized via the linker behavior dropdown in Project Options. To access this double-click on the iOS project and browse to iOS Build > Linker Options, as illustrated below: The linking process can be customized via the linker behavior dropdown in the Project Properties in Visual Studio.
Your included framework has no Simulator (i386) slice:
$ xcrun -sdk iphoneos lipo -info Pods/OpenTokSDK-WebRTC/Opentok.framework/Versions/A/Opentok
Architectures in the fat file: Pods/OpenTokSDK-WebRTC/Opentok.framework/Versions/A/Opentok are: armv7 armv7s
So its classes can't be linked for the Simulator.
Also if you plan to use CocoaPods you could remove the Cordova project and static library entirely and add pod 'Cordova'
to your Podfile.
I've seen similar issues before when trying to run the Xcode project, rather than the XCWorkspace. The issue you're having sounds like it's because you're not running the workspace.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With