blakgeek / cordova-plugin-cocoapods-support

A Cordova/PhoneGap plugin to add support for CocoaPods dependencies.
MIT License
72 stars 71 forks source link

Subsequent Builds Fail #2

Closed theneverstill closed 8 years ago

theneverstill commented 8 years ago

All subsequent build attempts are failing for me, requiring a wipe of platforms/plugins directories before a new build will succeed. The error:

ld: library not found for -lPods-appName clang: error: linker command failed with exit code 1 (use -v to see invocation)

\ BUILD FAILED **

The following build commands failed: Ld build/emulator/appName.app/appName normal i386 (1 failure)

Error: Error code 65 for command: xcodebuild with args: -xcconfig,path-to-workspace/platforms/ios/cordova/build-debug.xcconfig,-project,appName.xcodeproj,ARCHS=i386,-target,I am,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=path-to-workspace/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=path-to-workspace/platforms/ios/build/sharedpch

E.g.

  1. Start with a clean project
  2. ionic state restore
  3. ionic build ios
  4. Note build is successful
  5. ionic build ios
  6. Note build failed
theneverstill commented 8 years ago

My guess is this has to do with ionic calling .xcodeproj instead of .xcworkspace.

If I leave an emulate command running (despite the above error), then fire up the emulator via Xcode using the .xcworkspace, it works fine and will connect with the command line / emulator control.

blakgeek commented 8 years ago

You are right. It's an issue with Cordova. Let me look into what if anything I can do about this.

theneverstill commented 8 years ago

Possible solution: https://gist.github.com/jcayzac/9522678

Mainly referring to the last chunk: # Fix cordova's scripts to use the workspace instead of the project

theneverstill commented 8 years ago

Yeah, that was the right idea.. just need to make a few adjustments based on cordova version.

In file build.js [platforms/ios/cordova/lib/build.js], function getXcodeArgs change (in both device and emulator block):

theneverstill commented 8 years ago

Can you make this into a (node, not shell) hook that changes the appropriate lines in build.js?

blakgeek commented 8 years ago

Should be working now.

theneverstill commented 8 years ago

xcodebuild: error: The workspace named "appName" does not contain a scheme named "appName". The "-list" option can be used to find the names of the schemes in the workspace.

theneverstill commented 8 years ago

Okay, to get it working based on your latest changes, I replaced all ".xcodeproj" with ".xcworkspace" and that worked.

blakgeek commented 8 years ago

In the build.js? Had you modified the file already? On Jul 20, 2016 10:05 PM, "Lucas Still" notifications@github.com wrote:

Okay, to get it working based on your latest changes, I replaced all ".xcodeproj" with ".xcworkspace" and that worked.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blakgeek/cordova-plugin-cocoapod-support/issues/2#issuecomment-234137065, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyU3imbyHccVzJHwtO3sG7fQAHBXqLJks5qXtP4gaJpZM4JRPmw .

theneverstill commented 8 years ago

I updated to your latest version (which made the two changes noted previously to build.js), but that unfortunately resulted in the aforementioned new error. In addition to your two changes, I did a find/replace in build.js to replace all occurrences of ".xcodeproj" with ".xcworkspace" and that fixed the build.

blakgeek commented 8 years ago

Ok. Let me test with Ionic and see if it uses a different build.js. What version of Ionic are you using?

On Wed, Jul 20, 2016 at 10:27 PM, Lucas Still notifications@github.com wrote:

I updated to your latest version (which made the two changes noted previously to build.js), but that unfortunately resulted in the aforementioned new error. On top of your two changes, I did a find/replaces in build.js to replace all occurrences of ".xcodeproj" with ".xcworkspace" and that fixed the build.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blakgeek/cordova-plugin-cocoapod-support/issues/2#issuecomment-234139617, or mute the thread https://github.com/notifications/unsubscribe-auth/AAyU3npdWk_jWw3IzjRwOnbsIZ1mTqjVks5qXtkDgaJpZM4JRPmw .

Want to waste some time or challenge your mental skills? Check out my games on www.bggamecentral.com or download them from the App Stores https://itunes.apple.com/us/artist/henry-lawton/id895605107 [image: https://play.google.com/store/search?q=pub:BG%20Games&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1] https://play.google.com/store/search?q=pub:BG%20Games&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1 Get it on Google https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png

theneverstill commented 8 years ago

node: v6.2.0 cordova: 6.2.0 ionic: 2.0.0-beta.32

blakgeek commented 8 years ago

And what version of the iOS platform?

theneverstill commented 8 years ago

4.1.1

blakgeek commented 8 years ago

@theneverstill Would you mind trying the latest version of the plugin? It should work completely out of the box now.

theneverstill commented 8 years ago

That did it - thanks!!

theneverstill commented 8 years ago

Hmm.. now it seems like the first build never actually completes (I didn't discover this until I reset my platforms and plugins). The build "finishes", ie the command stops without any noticeable errors, but it doesn't say that the build was completely. Also the simulator never launches. However, if I immediately re-run the command, the build launches fine.

blakgeek commented 8 years ago

@theneverstill I found the issue. I needed to return a promise because part of the plugin's execution was async. It's fixed in the latest release.