Resource bundle not copied into project #1186

Closed
akaralar opened this Issue Jul 6, 2013 · 13 comments

Projects

None yet

6 participants

@akaralar
akaralar commented Jul 6, 2013

Project with MapBox SDK 1.0.3 integrated builds okay but throws the following exception upon running.

2013-07-06 06:36:28.426 Demo[25507:c07] *** Assertion failure in +[RMMapView pathForBundleResourceNamed:ofType:], /Users/akaralar/Developer/work/socialiq/Demo/Pods/MapBox/MapView/Map/RMMapView.m:416
2013-07-06 06:36:28.432 Demo[25507:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Resource bundle not found in application.'

with cocoapods 0.22 the pod install was failing with mapbox sdk, 0.22.1 fixed that but now i'm getting this error. the library works okay when integrated manually.

--Podfile--

platform :ios, '5.0'

pod 'AFNetworking'
pod 'MapBox'
pod 'BlocksKit'
pod 'MBProgressHUD'`
@alloy
Member
alloy commented Jul 8, 2013

@akaralar Can you check if removing the Pods/MapBox dir and running pod install again fixes the issue? Otherwise, can you list the contents of the Pods/Pods-resources.sh script?

@incanus I actually think the spec should be using the pre_install hook and use the pod argument’s root dir. This ensures it will also work when used as a local dev clone (with the :path option).

@akaralar
akaralar commented Jul 8, 2013

@alloy no it doesn't fix the issue, Pods-resources.sh is as follows

#!/bin/sh
set -e

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

install_resource()
{
  case $1 in
*.storyboard)
  echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
  ibtool --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
  ;;
*.xib)
    echo "ibtool --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
  ibtool --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
  ;;
*.framework)
  echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  echo "cp -fpR ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  cp -fpR "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  ;;
*.xcdatamodeld)
  echo "xcrun momc ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xcdatamodeld`.momd"
  xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xcdatamodeld`.momd"
  ;;
*)
  echo "${PODS_ROOT}/$1"
  echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY"
  ;;
  esac
}

rsync -avr --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rm "$RESOURCES_TO_COPY"
install_resource 'Resources/MapBox.bundle'
@alloy
Member
alloy commented Jul 8, 2013

@akaralar @incanus Ah, you know, I think this is also fixed when changing to the pre_install hook, because then you can just include the resulting resource bundle in the resources attribute of the spec and this will all just work as expected. In short, ‘manually’ appending to the resources script is no longer supported.

@miminashi

I got same Error.
I tried to add Pods/Resources/MapBox.bundle to "Copy Bundle Resources" manually, then it works.

@incanus
incanus commented Jul 10, 2013

Taking a look at this. I feel like the resources process has been changing a ton lately, but this latest approach sounds pretty clean so I'm looking forward to getting this stabilized once and for all.

@incanus
incanus commented Jul 10, 2013

Ok, I've been experimenting with altering my spec to something more like this: https://gist.github.com/incanus/231ba5fe1844aff2774d

However, now I'm getting build errors related to Proj4 and I'm not sure why.

@incanus
incanus commented Jul 10, 2013

This is probably related to me (while editing) making MapBox a local pod.

Directory not found for option '-L/Users/incanus/Documents/Projects/Development Seed/MapBox/MapBox Me/Pods/MapBox/Proj4'
@incanus
incanus commented Jul 10, 2013

Ok, in order to work around the local pod problem, I made a commit to the develop branch of our SDK to try this out in the podspec. But the bundle is still not being copied.

mapbox/mi-sdk-legacy@20869b0

@dcloud dcloud referenced this issue in sunlightlabs/congress-ios Jul 15, 2013
Closed

beware cocoapods + MapBox #253

@nejra
nejra commented Jul 16, 2013

is this going to be officially fixed or I must use older version of cocoapods?

@hfossli
hfossli commented Jul 24, 2013

Any progress here?

@hfossli
hfossli commented Jul 25, 2013

Okay. I have some new information and a solution which worked for me..

I have 3 targets in Xcode: "Core, Compdev, Test".

I had this Podfile

platform :ios, '5.0.1'

pod 'ReactiveCocoa', '~> 1.8.1'
pod 'JLRoutes', '~> 1.3'
pod 'AGGeometryKit'
pod 'AGMoviePlayerView', '~> 0.2.2'
# several other pods removed for clarity on github thread

target :compdev, :exclusive => true  do
    link_with ['IVYCompDev']
        pod 'ORKeyboardReactingApplication', :git => 'https://github.com/orta/ORSimulatorKeyboardAccessor.git', :inhibit_warnings => true
end

Then my Pods-compdev-resources.sh looked like this

#!/bin/sh
set -e

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

install_resource()
{
    # Code removed for clarity on github thread
}

rsync -avr --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rm -f "$RESOURCES_TO_COPY"
@hfossli
hfossli commented Jul 25, 2013

After removing the :exclusive => true flag everything seemed correct.

This is what my Pod-compdev-resources.sh looks like now

#!/bin/sh
set -e

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

install_resource()
{
    # Code removed for clarity on github thread
}
install_resource 'AGMoviePlayerView/Source/AGMoviePlayerViewController.xib'
install_resource 'AGMoviePlayerView/Source/AGMoviePlayerViewController~iphone.xib'
install_resource 'AGMoviePlayerView/Graphics/mp_pause.png'
install_resource 'AGMoviePlayerView/Graphics/mp_pause@2x.png'
install_resource 'AGMoviePlayerView/Graphics/mp_play.png'
install_resource 'AGMoviePlayerView/Graphics/mp_play@2x.png'

rsync -avr --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
rm -f "$RESOURCES_TO_COPY"
@incanus
incanus commented Jul 29, 2013

The MapBox spec is fixed now per mapbox/mi-sdk-legacy#276.

@fabiopelosin fabiopelosin added a commit that closed this issue Aug 1, 2013
@fabiopelosin fabiopelosin [Changelog]
Closes #743
Closes #1186
Closes #809
Closes #1075
01f2a94
@gpalouk gpalouk pushed a commit to gpalouk/mapbox-ios-sdk that referenced this issue Nov 9, 2013
@incanus incanus refs CocoaPods/CocoaPods#1186 20869b0
@hstdt hstdt referenced this issue in ArtSabintsev/Harpy Dec 24, 2015
Closed

It crashed if I set forceLanguageLocalization #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment