huynguyencong / DataCache

Simple disk and memory cache for iOS
MIT License
101 stars 20 forks source link

Embedding in iMessage App #7

Closed otymartin closed 7 years ago

otymartin commented 8 years ago

@huynguyencong I'm using this library in an iMessage Sticker app.

When submitting my build to iTunes for review, I got these errors.

Error 1: ITMS-90205 - Invalid Bundle
Invalid Bundle. The bundle at 'MyAppName.app/PlugIns/MessagesExtension.appex' contains disallowed nested bundles. Refer to https://developer.apple.com/go/?id=framework-imessage for a workaround.
Error 2: ITMS-90206 - Invalid Bundle
Invalid Bundle. The bundle at 'MyAppName.app/PlugIns/MessagesExtension.appex' contains disallowed file 'Frameworks'.

The solution I found from this stackoverflow thread was to run this script in the MessagesExtension build phase.

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then 
    rm -fr Frameworks
fi

But the problem is when I do this, xcode gives this error

dyld: Library not loaded: @rpath/DataCache.framework/DataCache
  Referenced from: /private/var/containers/Bundle/Application/70472D74-21E6-4362-9481-8DC624D668DA/MyAppName.app/PlugIns/MessagesExtension.appex/MessagesExtension
  Reason: image not found

Apple provides a work around here but it doesnt specifically address frameworks embedded with cocoapods so i dont know how to follow it.

My Pods

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

target 'MyAppName' do
    use_frameworks!
end

target 'MessagesExtension' do
  pod 'Firebase'
  pod 'DataCache'
  pod 'BuddyBuildSDK'
  pod 'Firebase/Storage'
  pod 'FirebaseDatabase'
  use_frameworks!
end
huynguyencong commented 8 years ago

Have you tried accepted answer:

_Turns out the error is related to using Swift (both the app and the extension make use of Swift).

For the app, I had to set:

Embedded Content Contains Swift Code: YES and for the extension:

Embedded Content Contains Swift Code: NO In the build settings. It really wasn't clear at all from the error message that this was the issue, but it did in fact resolve it._

otymartin commented 8 years ago

@huynguyencong I dont have that option Embedded content contains swift code. I dont see it in xcode 8 for iMessage app or its containing app

Update*\ Actually i see it now so let me try to solve

otymartin commented 8 years ago

@huynguyencong No luck it didnt work. Im attempting apples solution here but it keeps telling me DataCache location not found. really frustrating why apple release xcode 8 without support for 3rd party extensions like we are used to.

huynguyencong commented 8 years ago

I have no idea how to fix. If you can't find a solution, you can download file DataCache.swift, and add it to your project like a normal source file, and remove pod in Podfile. Sorry because I can't help you.