realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.31k stars 2.15k forks source link

Cannot submit an app built with RealmSwift to AppStore #1907

Closed xiles closed 9 years ago

xiles commented 9 years ago

I did installation steps in swift documentation. added Framework Search Path as $(PROJECT_DIR)/RealmSwift.framework/Frameworks

When I tried to submit to AppStore,

First, I got an error "Invalid Signature. Code object is not signed at all. The binary at path [MyApp.app/Frameworks/RealmSwift.framework/strip-frameworks.sh] contains an invalid signature. ...."

So I added following command in Build Phases > Run Script rm ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework/strip-frameworks.sh

Now I got this error. "Invalid Bundle. The bundle at 'MyApp.app/Frameworks/RealmSwift.framework' contains disallowed nested bundles." "Invalid Bundle. The bundle at 'MyApp.app/Frameworks/RealmSwift.framework' contains disallowed file 'Frameworks'."

Tested with Xcode 6.3.1, 6.3.2GM

Also tried: Set Embedded Content Contains Swift Code to YES in Build Settings

segiddins commented 9 years ago

@xiles, with what version of RealmSwift was this happening for you? What are your iOS/OS X deployment targets?

michaelloistl commented 9 years ago

Having the same issue with RealmSwift 0.92.2.

screen shot 2015-05-11 at 17 35 37

screen shot 2015-05-11 at 17 42 28

xiles commented 9 years ago

RealmSwift 0.92.2 Deployment Target iOS 8.0

segiddins commented 9 years ago

@xiles @michaelloistl one more question: how are you including RealmSwift in your project? Are you using the pre-built binary in the release zip, Carthage, CocoaPods, etc.?

xiles commented 9 years ago

As a dynamic framework. As i wrote in first comment, i followed exact steps in documentation.

michaelloistl commented 9 years ago

As a dynamic framework as well (due to troubles with cocoapod's framework support in connection with other pods). Double checked every step several times with you install doc.

alexanderjarvis commented 9 years ago

Sorry I can't help with why this doesn't work for you – but this is working for me. I have installed RealmSwift 0.92.2 with cocoapods and it codesigns and submits the build to the store fine so there must be something else wrong there. Hope that helps isolate the issue as at least it is working for me.

jpsim commented 9 years ago

I'd guess the users having problems here are the ones using the pre-built dynamic frameworks for iOS, as distributed through:

  1. the release zip available from https://realm.io
  2. the GitHub releases zips
  3. Carthage (by extension of the previous point)

So CocoaPods users would be unaffected here.

xiles commented 9 years ago

Any workaround without using CocoaPod? I was about to release an update of my app 😭

segiddins commented 9 years ago

So, two issues at play here:

1) The strip-frameworks.sh scripts have a shebang at the top, and thus iTC wants to see them signed. Easy fix: remove the shebang. 2) The iOS app store doesn't seem to allow nesting bundles (and thus nesting frameworks), so we'll need to ship Realm.framework alongside RealmSwift.framework, instead of inside of it.

jpsim commented 9 years ago

I'd expect that moving away from nested frameworks will actually greatly simplify installation, as well as avoiding some name tool hackery.

alazier commented 9 years ago

I think having to include both frameworks will be annoying. I think it would be better to compile the static Realm.framework into RealmSwift.framework and vendor the Realm headers in a second Realm module. Then users would only have to drag in a single framework to use Realm or RealmSwift. I'm not sure if this will work, but if it does it will be a better experience so might be worth trying.

jpsim commented 9 years ago

You're right that it would definitely be a better experience, but you'll recall that several people, you and I included, attempted to do this without success. And I really think that dragging two frameworks into a project as opposed to one is a negligible difference in user experience compared to not having it work at all.

alazier commented 9 years ago

I have actually never tried this approach as we were originally committed to building from source. Not sure exactly what you have tried, but I wouldn't be surprised if there were issues. Do you remember what the problem was?

malcommac commented 9 years ago

I don't know if it's related but I've just tried to compile my app with RealmSwift and I get this: /Users/danielemm/Library/Developer/Xcode/DerivedData/Shake-ajzskdhbojclfuhenmckcziroqxk/Build/Intermediates/Shake.build/Debug-iphonesimulator/Shake.build/Script-64D8CA911AFCF80300E40B07.sh: line 2: /Users/danielemm/Library/Developer/Xcode/DerivedData/Shake-ajzskdhbojclfuhenmckcziroqxk/Build/Products/Debug-iphonesimulator/Shake.app/Frameworks/RealmSwift.framework/strip-frameworks.sh: No such file or directory

Seems stip-frameworks.sh was removed but something try to use it. (Just to be sure but I think it's not the case, I've already done a clean & build, removed and reinstalled pods and deleted derived data directory)

malcommac commented 9 years ago

Ok solved, maybe the old version on CocoaPods has installed this call as new Run Script in Build Phases of my project. Just removed, everything it's okay :)

acoleman-apc commented 9 years ago

Commenting to subscribe to the thread as I am having the same issue in 0.92.3.

fishfisher commented 9 years ago

Same issue for me in 0.92.3.

Is there a temporary quickfix available for this issue? Struggling to get my submission through.

EDIT: I switched over to CocoaPods and it went through just fine!

webmagnets commented 9 years ago

Should I drag the nested framework into its parent's directory?

bendodson commented 9 years ago

The fix for me was to make sure that in your Build Phases, the "Run Script" is after the "Embed Frameworks" - if "Run Script" comes first then the Realm.framework isn't in the correct location yet.

Also, as of 0.93.2 there is no strip-frameworks.sh in RealmSwift.framework so you have to reference the Realm.framework instead in the Run Script.

fpisidoro commented 9 years ago

Thanks @bendodson , your two suggestions worked for me. To reiterate (in case someone needs help understanding the steps), in Build Phases, you can drag "Run Script" beneath "Embed Frameworks". Then in the Run Script, change RealmSwift.framework (as originally instructed by the Realm installation instructions) to Realm.framework.

pagekurnie commented 8 years ago

Thanks fpisidoro. I've been struggling with issue for a while. Dragging the "Run Script" was the trick.

abeaclark commented 7 years ago

Amazing @bendodson. Thank you for that easy fix.