blakgeek / cordova-plugin-cocoapods-support

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

I am seeing an error and don't know how to resolve it #9

Closed richtera closed 8 years ago

richtera commented 8 years ago

My plugin looks like this:

<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-auth0" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
  <name>Auth0Native</name>
  <js-module name="Auth0Native" src="www/auth0native.js">
    <clobbers target="cordova.plugins.auth0native" />
  </js-module>
  <platform name="android">
    <config-file parent="/*" target="res/xml/config.xml">
      <feature name="Auth0Native">
        <param name="android-package" value="CordovaPluginuth0.Auth0Native" />
      </feature>
    </config-file>
    <config-file parent="/*" target="AndroidManifest.xml" />
    <source-file src="src/android/Auth0Native.java" target-dir="src/CordovaPluginAuth0/Auth0Native" />
  </platform>
  <platform name="ios">
    <pods-config ios-min-version="9.0" uses-frameworks="true" />
    <pod id="Lock" version="1.24" />
    <config-file parent="/*" target="config.xml">
      <feature name="Auth0Native">
        <param name="ios-package" value="Auth0Native" />
      </feature>
    </config-file>
    <source-file src="src/ios/Auth0Native.m" />
  </platform>
</plugin>

Then I add it to my cordova project and it correctly do the initialization:

Adding ios project...
iOS project created with cordova-ios@4.1.1
Installing "code-push" for ios
Installing "cordova-plugin-app-name" for ios
Installing "cordova-plugin-auth0" for ios
Installing "cordova-plugin-cocoapod-support" for ios
Installing "cordova-plugin-code-push" for ios
Dependent plugin "code-push" already installed on ios.
Installing "cordova-plugin-file" for ios
Installing "cordova-plugin-compat" for ios

The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.

Installing "cordova-plugin-file-transfer" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-zip" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-dialogs" for ios
Installing "cordova-plugin-device" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.
Installing "cordova-plugin-console" for ios
Plugin "cordova-plugin-device" already installed on ios. Making it top-level.
Dependent plugin "cordova-plugin-dialogs" already installed on ios.
Dependent plugin "cordova-plugin-file" already installed on ios.
Dependent plugin "cordova-plugin-file-transfer" already installed on ios.
Installing "cordova-plugin-hockeyapp" for ios
Installing "cordova-plugin-inappbrowser" for ios
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-statusbar" for ios
Installing "cordova-plugin-whitelist" for ios
Dependent plugin "cordova-plugin-zip" already installed on ios.
Installing "ionic-plugin-keyboard" for ios
Running command: /Users/andy/Development/gormenghast/ionic2/hooks/after_prepare/010_add_platform_class.js /Users/andy/Development/gormenghast/ionic2
add to body class: platform-ios
Attempting to set app name
Setting App Name:  Text Invader
Searching for new pods
Checking cordova-plugin-app-name for pods.
Checking cordova-plugin-auth0 for pods.
cordova-plugin-auth0 requires pod: Lock
Checking cordova-plugin-code-push for pods.
Checking cordova-plugin-compat for pods.
Checking cordova-plugin-console for pods.
Checking cordova-plugin-device for pods.
Checking cordova-plugin-dialogs for pods.
Checking cordova-plugin-file for pods.
Checking cordova-plugin-file-transfer for pods.
Checking cordova-plugin-hockeyapp for pods.
Checking cordova-plugin-inappbrowser for pods.
Checking cordova-plugin-splashscreen for pods.
Checking cordova-plugin-statusbar for pods.
Checking cordova-plugin-whitelist for pods.
Checking cordova-plugin-zip for pods.
Checking ionic-plugin-keyboard for pods.
Checking config.xml for pods.
Installing pods
Sit back and relax this could take a while.
Analyzing dependencies
Downloading dependencies
Installing AFNetworking (3.1.0)
Installing CocoaLumberjack (2.3.0)
Installing Lock (1.24.0)
Installing Masonry (0.6.4)
Generating Pods project

Integrating client project

[!] Please close any current Xcode sessions and use `MyApp.xcworkspace` for this project from now on.

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.

Updating ios build to use workspace.
Adding schemes

But during build I get (the first build just stops) I see errors like this:

error: Resource "/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Products/Debug-iphonesimulator/Lock/Auth0.bundle" not found. Run 'pod install' to update the copy resources script.

Any suggestions on what to look at first?

blakgeek commented 8 years ago

There is an issue with how command line build is executing. If you open the ios project's workspace in XCode you can build and run with no issues.

Let me look into it.

blakgeek commented 8 years ago

I think is related to a bug in CocoaPods. See https://github.com/CocoaPods/CocoaPods/issues/4963 and https://github.com/CocoaPods/CocoaPods/pull/4954. It's marked as fixed but this looks like the same issue.

It's looking for the bundle to exist here $PODS_CONFIGURATION_BUILD_DIR/Lock/Auth0.bundle when it's actually here $PODS_CONFIGURATION_BUILD_DIR/<app_name>.app/Auth0.bundle

richtera commented 8 years ago

I will try but I did get errors when trying to build in xcode. But it was a lot harder to copy and paste them into here. It was complaining about not finding resources as well but the paths affected all pods. SonI got 4 errors. Will try to paste them tonorrow

blakgeek commented 8 years ago

@richtera I added a new attribute called fix-bundle-path to the pod tag that allows you to work around the bug in CocoaPods.

If you change your entry to the following your build will start working.

<pod id="Lock" version="1.24" fix-bundle-path="Lock/Auth0.bundle"/>

Be aware that when and if Auth0 fixes their pod spec you'll need to remove the fix-bundle-path attribute or may cause builds to start failing.

Let me know if you run into more issues.

richtera commented 8 years ago

When adding the platform I saw a bunch of script sources but that's probably debugging code you put in:

Sending stats

Pod installation complete! There is 1 dependency from the Podfile and 4 total pods installed.

#!/bin/sh
set -e

mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"

RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"

XCASSET_FILES=()

case "${TARGETED_DEVICE_FAMILY}" in
  1,2)
    TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
    ;;
  1)
    TARGET_DEVICE_ARGS="--target-device iphone"
    ;;
  2)
    TARGET_DEVICE_ARGS="--target-device ipad"
    ;;
  *)
    TARGET_DEVICE_ARGS="--target-device mac"
    ;;
esac

realpath() {
  DIRECTORY="$(cd "${1%/*}" && pwd)"
  FILENAME="${1##*/}"
  echo "$DIRECTORY/$FILENAME"
}

install_resource()
{
  if [[ "$1" = /* ]] ; then
    RESOURCE_PATH="$1"
  else
    RESOURCE_PATH="${PODS_ROOT}/$1"
  fi
  if [[ ! -e "$RESOURCE_PATH" ]] ; then
    cat << EOM
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
EOM
    exit 1
  fi
  case $RESOURCE_PATH in
    *.storyboard)
      echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
      ;;
    *.xib)
      echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
      ;;
    *.framework)
      echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      ;;
    *.xcdatamodel)
      echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
      xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
      ;;
    *.xcdatamodeld)
      echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
      xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
      ;;
    *.xcmappingmodel)
      echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
      xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
      ;;
    *.xcassets)
      ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
      XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
      ;;
    *)
      echo "$RESOURCE_PATH"
      echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
      ;;
  esac
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
  install_resource "$PODS_CONFIGURATION_BUILD_DIR/Lock/Auth0.bundle"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
  install_resource "$PODS_CONFIGURATION_BUILD_DIR/Lock/Auth0.bundle"
fi

mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
rm -f "$RESOURCES_TO_COPY"

if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
  # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
  while read line; do
    if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
      XCASSET_FILES+=("$line")
    fi
  done <<<"$OTHER_XCASSETS"

  printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

#!/bin/sh
set -e

mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"

RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"

XCASSET_FILES=()

case "${TARGETED_DEVICE_FAMILY}" in
  1,2)
    TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
    ;;
  1)
    TARGET_DEVICE_ARGS="--target-device iphone"
    ;;
  2)
    TARGET_DEVICE_ARGS="--target-device ipad"
    ;;
  *)
    TARGET_DEVICE_ARGS="--target-device mac"
    ;;
esac

realpath() {
  DIRECTORY="$(cd "${1%/*}" && pwd)"
  FILENAME="${1##*/}"
  echo "$DIRECTORY/$FILENAME"
}

install_resource()
{
  if [[ "$1" = /* ]] ; then
    RESOURCE_PATH="$1"
  else
    RESOURCE_PATH="${PODS_ROOT}/$1"
  fi
  if [[ ! -e "$RESOURCE_PATH" ]] ; then
    cat << EOM
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
EOM
    exit 1
  fi
  case $RESOURCE_PATH in
    *.storyboard)
      echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
      ;;
    *.xib)
      echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
      ;;
    *.framework)
      echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
      ;;
    *.xcdatamodel)
      echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
      xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
      ;;
    *.xcdatamodeld)
      echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
      xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
      ;;
    *.xcmappingmodel)
      echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
      xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
      ;;
    *.xcassets)
      ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
      XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
      ;;
    *)
      echo "$RESOURCE_PATH"
      echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
      ;;
  esac
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
  install_resource "$PODS_CONFIGURATION_BUILD_DIR/Reader0.app/Auth0.bundle"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
  install_resource "$PODS_CONFIGURATION_BUILD_DIR/Reader0.app/Auth0.bundle"
fi

mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
rm -f "$RESOURCES_TO_COPY"

if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
then
  # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
  while read line; do
    if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
      XCASSET_FILES+=("$line")
    fi
  done <<<"$OTHER_XCASSETS"

  printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi

Then I am getting a variation of the error:

error: Resource "/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Products/Debug-iphonesimulator/MyApp.app/Auth0.bundle" not found. Run 'pod install' to update the copy resources script.

So it definitely seems a lot closer, but for some reason it's not quite right. Maybe my fix-bundle-path should be something else? Not sure. Also I am not sure if this has anything to do with the pluging, but the first time I execute build it just stops mid stream:

.
.
.
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c-header -arch i386 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/andy/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/andy/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DCOCOAPODS=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=8.0 -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Intermediates/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Cordova-generated-files.hmap -I/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Intermediates/CordovaLib.build/Debug-iphonesimulator/CordovaLib.build/Cordova-own-target-headers.hmap -I/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-

The log just stops and doesn't even finish outputting the log line. Then the second time I get the error. As promised yesterday. Here is the output from XCode internally. It seems to still have the original 4 errors even after the latest update:

ld: warning: directory not found for option '-L/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-fcmsxemojeybtvcvurnxakxzkfhv/Build/Products/Debug-iphonesimulator/AFNetworking'
ld: warning: directory not found for option '-L/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-fcmsxemojeybtvcvurnxakxzkfhv/Build/Products/Debug-iphonesimulator/CocoaLumberjack'
ld: warning: directory not found for option '-L/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-fcmsxemojeybtvcvurnxakxzkfhv/Build/Products/Debug-iphonesimulator/Lock'
ld: warning: directory not found for option '-L/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-fcmsxemojeybtvcvurnxakxzkfhv/Build/Products/Debug-iphonesimulator/Masonry'
ld: library not found for -lAFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Maybe something went wrong with updating the plugin. I will pull it from github directly after I get back from an errand.

blakgeek commented 8 years ago

Yep. Forgot to remove my debugging statement.

Can your run the this and post the location it returns?

find /Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Products/Debug-iphonesimulator -name Auth0.bundle

Also just for kicks can your remove and re-add the ios platform and your plugin then try the build again?

Something is off. Clarity the fix was to modify this line from

install_resource "$PODS_CONFIGURATION_BUILD_DIR/Lock/Auth0.bundle"

to

install_resource "$PODS_CONFIGURATION_BUILD_DIR/Reader0.app/Auth0.bundle"

by replacing the first part of the bundle path with the app name because that is where the files actually end up.

But your error message is showing the following:

/Users/.../MyApp.app/Auth0.bundle

I'm not sure how MyApp.app is being used instead of Reader0.app since the debug output is showing the actual content of the script.

richtera commented 8 years ago

Found something interesting. When loading the xcworkspace manually everything compiled. How do I convince cordova build to use the workspace rather than the project? I think that's where things are going awry.

blakgeek commented 8 years ago

The plugin already handles that by modifying the build.js used by Cordova. And yes you do need to open the workspace.

richtera commented 8 years ago

Hmmm ok it's definitely getting closer. The XCode build now works, but the command line build still has problems. I am getting this now:

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
        { platform:iOS }

    Missing required device specifier option.
    The device type “Generic iOS Device” requires that either “name” or “id” be specified.
    Please supply either “name” or “id”.

@blakgeek: I figured out I was using an older version of cordova-ios. Once I upgraded that part of the problem went away.

blakgeek commented 8 years ago

Fantastic. What version of cordova-ios were you using?

richtera commented 8 years ago

Ughhh, I am not sure since I just overwrote it with the new version by doing npm install -g cordova-ios, sorry. I had installed it a long while ago and never upgraded.

blakgeek commented 8 years ago

No problem.

richtera commented 8 years ago

But I am stuck with this Missing device thingy since I am trying to build my app on circleci. On there I can't really open XCode to build it manually. Any suggestions how to resolve this last straggling problem?

blakgeek commented 8 years ago

You need specify the device you want to use. Right now it's defaulting the Generic Device. See this SO post http://stackoverflow.com/questions/22310526/cordova-start-specific-ios-emulator-image.

richtera commented 8 years ago

Hmmm, this seems to be just talking about emulators. I am building with the --release --device flags and should not really need to specify any device. The page doesn't talk about anything regarding device builds. For emulation it does make sense to me that I have to specify the device type of the emulator I'd like to use.

richtera commented 8 years ago

Hmmm changing build.js to say:

function getXcodeArgs(projectName, projectPath, configuration, isDevice) {
    var xcodebuildArgs;
    if (isDevice) {
        xcodebuildArgs = [
            '-xcconfig', path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
            '-workspace', projectName + '.xcworkspace',
            '-scheme', projectName,
            '-configuration', configuration,
            '-destination', 'generic/platform=iOS',
            'build',
            'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'device'),
            'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch')
        ];
    } else { // emulator
        xcodebuildArgs = [
            '-xcconfig', path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
            '-workspace', projectName + '.xcworkspace',
            '-scheme', projectName,
            '-configuration', configuration,
            '-sdk', 'iphonesimulator',
            '-destination', 'platform=iOS Simulator',
            'build',
            'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'emulator'),
            'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch')
        ];
    }
    return xcodebuildArgs;
}

I.e. adding " '-destination', 'generic/platform=iOS'," Does revert it to generate the original error:

PhaseScriptExecution [CP]\ Copy\ Pods\ Resources /Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Intermediates/MyApp.build/Release-iphoneos/MyApp.build/Script-B0A1BDBD5B88DA04C7E19EAC.sh
    cd /Users/andy/Development/gormenghast/ionic2/platforms/ios
    /bin/sh -c /Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Intermediates/MyApp.build/Release-iphoneos/MyApp.build/Script-B0A1BDBD5B88DA04C7E19EAC.sh
error: Resource "/Users/andy/Library/Developer/Xcode/DerivedData/MyApp-grkmimdnbhtjbpahflokqvfawnna/Build/Products/Release-iphoneos/Lock/Auth0.bundle" not found. Run 'pod install' to update the copy resources script.

** BUILD FAILED **

But it does resolve the destination specification issues. Not having luck with this. Since all of this works from the XCode UI just fine I am just not exactly sure where to start fixing this to work on a continuous integration server.

helderdb commented 7 years ago

Getting same error, added the <pod id="Lock" version="1.24" fix-bundle-path="Lock/Auth0.bundle"/> line but still getting the same error. using cordova 6.3.1 pod 1.0.1 is there a fix?

blakgeek commented 7 years ago

Not currently. I'll look into it this week.

krishnasagr commented 7 years ago

Any news ?