Skip to content

Failed to verify bitcode in TNSWidgets.framework/TNSWidgets #4019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jpakulski opened this issue Oct 12, 2018 · 18 comments
Closed

Failed to verify bitcode in TNSWidgets.framework/TNSWidgets #4019

jpakulski opened this issue Oct 12, 2018 · 18 comments
Labels
build Describes issues related to build operations needs more info os: ios
Milestone

Comments

@jpakulski
Copy link

jpakulski commented Oct 12, 2018

Environment

Component nativescript has 4.2.4 version and is up to date.
Component tns-core-modules has 4.2.1 version and is up to date.
Component tns-ios has 4.2.0 version and is up to date.

Plugins

    "@angular/animations": "^6.1.10",
    "@angular/cli": "^6.1.10",
    "@angular/common": "^6.1.10",
    "@angular/compiler": "^6.1.10",
    "@angular/core": "^6.1.10",
    "@angular/forms": "^6.1.10",
    "@angular/http": "^6.1.10",
    "@angular/platform-browser": "^6.1.10",
    "@angular/platform-browser-dynamic": "^6.1.10",
    "@angular/router": "^6.1.10",
    "nativescript-angular": "^6.1.0",
    "nativescript-bitmap-factory": "^1.7.1",
    "nativescript-directions": "^1.3.0",
    "nativescript-drawingpad": "^3.0.3",
    "nativescript-drop-down": "^4.0.1",
    "nativescript-email": "^1.5.3",
    "nativescript-fontawesome": "^1.0.0",
    "nativescript-gradient": "^2.0.1",
    "nativescript-iqkeyboardmanager": "^1.3.0",
    "nativescript-ng-shadow": "^2.1.0",
    "nativescript-phone": "^1.3.1",
    "nativescript-plugin-firebase": "^7.1.5",
    "nativescript-sentry": "^1.5.2",
    "nativescript-sqlite": "^2.2.3",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-ui-autocomplete": "^3.9.0",
    "nativescript-ui-listview": "^3.7.1",
    "nativescript-ui-sidedrawer": "^4.3.1",
    "nativescript-unit-test-runner": "^0.3.4",
    "node-sass": "^4.9.3",
    "npm": "^6.4.1",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.3.3",
    "tns-core-modules": "^4.2.1",
    "zone.js": "^0.8.26"

Describe the bug
Started when I was forced to update Xcode to version 10 (to make iOS 12 builds).

Happens when trying to create an Enterprise Archive using XCode. App builds fine but fails with the following error when Enterprise distribution is selected:

Failed to verify bitcode in TNSWidgets.framework/TNSWidgets:
error: Bundle only contains bitcode-marker /var/folders/5d/kv3n6r795l156_mwk8lzpfv00000gn/T/IDEDistributionOptionThinning.Sgt/Payload/hektor.app/Frameworks/TNSWidgets.framework/TNSWidgets (arm64)

I can run the app using the simulator and a dev. build on real device.

I helped reporting a similar issue with the firebase plugin here. And @EddyVerbruggen fixed the bad lib.

This is probably related to this issue.

To Reproduce
Create an Enterprise Archive in XCode 10 of an app which uses TNSWidgets.framework.

Expected behavior
Enterprise archive created.

Thank You

@jpakulski
Copy link
Author

A workaround which worked for me was to opt out of Xcode 10's new build system:

File -> Workspace Settings -> Build System -> Legacy Build System

This was mentioned by @larssn in this issue. Huge thank You.

@SephReed
Copy link

Opting out of the new build system did not solve the problem for me. 😞

@keithgulbro
Copy link

keithgulbro commented May 15, 2019

@jpakulski I had a similar issue when attempting to distribute my app via Enterprise, the workaround that worked in my instance was unchecking the 'Rebuild from Bitcode' option shown in the screenshot below.

When distributing apps via the traditional method of iOS App Store, I am able to recheck this option so it would certainly be nice for the settings to be consistent across distribution options.

Hopefully this helps! 😃

Screen Shot 2019-05-15 at 10 48 11 AM

@tylerablake
Copy link
Contributor

tylerablake commented May 16, 2019

@keithgulbro When I tried that the app immediately closed when I attempted to open it on a test device, are you able to run the app on a distributed device with Rebuild from Bitcode unchecked?

@rosen-vladimirov Is there any status update on this? I just tried to create a brand new Hello World app with Angular after updating to NS 5.4 as well as updating XCode to 10.2.1 and this issue still persists.

@rosen-vladimirov
Copy link
Contributor

Hey @tylerablake ,
Sorry for the late reply. Can you please post steps to reproduce the error? Also, can you send us a project which fails with the mentioned error?
We are unable to replicate the issue on our side :(

@tylerablake
Copy link
Contributor

Hi @rosen-vladimirov,

I'm currently using NS 5.4, but I've tried this on NS 5.2, 5.3, and 5.4 and it didn't work. I believe it worked on 5.1.

tns create test-bitcode-error
Select Angular
Select Hello World
cd test-bitcode-error
tns build ios -- release
Open the .xcodeproj file in XCode
Select Generic Device
Select a Signing Entity
Product > Archive
After the Archive succeeds and the distribution dialog pops up
Select Distribute
Select Ad Hoc
This pops up
image

Let me know if there is anything else I can do to help in resolving this.

@rosen-vladimirov
Copy link
Contributor

Hey @tylerablake ,
Can you please try the following steps:

tns create test-bitcode-error (Select Angular Select Hello World)
cd test-bitcode-error
tns build ios --for-device --release

And see if it will resolve the issue.
Also, is there a reason to use Xcode instead of the output of tns build command?

@tylerablake
Copy link
Contributor

Hi @rosen-vladimirov,

It still gives me the same error.

I don't think there is, I think that is just habit (maybe a bad one :) ) from an old tutorial when I was getting started.

I have been using the output from the tns build command for a few weeks now and I'm able to use the .ipa file from that to deploy successfully.

@facetious
Copy link

facetious commented Aug 23, 2019

@rosen-vladimirov I am also seeing the error from the screenshot above. I ran tns build ios --for-device --release. The .ipa file can be side-loaded onto a phone without issue, but when I try to add the .xcarchive to Xcode so I can upload to the AppStore, it still exhibits the same error.

From the distribution log:

                {
            code = 0;
            description = "Failed to verify bitcode in TNSWidgets.framework/TNSWidgets:\nerror: Bundle only contains bitcode-marker /var/folders/m1/v2grplhx53j9qptq0mvfsg300000gp/T/IDEDistributionOptionThinning.~~~u9lPL2/Payload/zzzzz.app/Frameworks/TNSWidgets.framework/TNSWidgets (armv7)\n\n";
            info =             {
            };
            level = ERROR;
            type = "malformed-payload";
        },
                {
            code = 0;
            description = "Failed to verify bitcode in sqlitewrapper.framework/sqlitewrapper:\nerror: Bundle only contains bitcode-marker /var/folders/m1/v2grplhx53j9qptq0mvfsg300000gp/T/IDEDistributionOptionThinning.~~~u9lPL2/Payload/zzzzz.app/Frameworks/sqlitewrapper.framework/sqlitewrapper (armv7)\n\n";
            info =             {
            };
            level = ERROR;
            type = "malformed-payload";
        }

@facetious
Copy link

I added to platforms/ios/internal/strip-dynamic-framework-architectures.sh right after the architecture-stripping loop:

  echo "Removing bitcode from $file"
  xcrun bitcode_strip -r "$file" -o "$file" || exit 1
  stripped="$stripped bitcode"

This has resolved the issue seen above. Build processing is pending on AppStore, but hopefully this restores functionality to the frameworks in question (specifically sqlitewrapper, which had lost all functionality).

I'm unable to find the source for this script, unfortunately, so I'm not sure where I should be modifying it for a pull request. Modifying the file within the platforms/ios folder is obviously not maintainable since that folder is generated and should be considered safe to destroy at any time.

@rosen-vladimirov rosen-vladimirov added this to the 6.1.1 milestone Aug 26, 2019
@cerealexx
Copy link

cerealexx commented Aug 29, 2019

@rosen-vladimirov I face the same issue if I try to build a dev ipa with xcode. I've also tried to build it without xcode with tns build ios --release --for-device but the generated ipa crashes on opening. Can't publish either since Apple rejects the binary because of the same reason. This started happening when upgraded the project to NS6 and webpack.
The app works fine with tns run iosor via xcode running though.

@facetious I've added those lines to the file you mentioned but xcode is still returning the same error. Do I need to build a new compilation/archive for this to work? Could you please explain the steps before/after adding this lines to the file?

@facetious
Copy link

@cerealexx Because this is added to a file in a generated folder, I wouldn't consider it safe to modify and then run tns <anything>. It likely wouldn't be changed by most commands, but I don't know specifically where it comes from, so I'm not sure.

After you've added those lines (as lines 62-64), building from Xcode should have lines like these in the Archive log:

/usr/bin/codesign --force --sign ... --preserve-metadata=identifier,entitlements ./TNSWidgets.framework/TNSWidgets
Removing bitcode from ./TNSCore.framework/TNSCore
Stripped ./TNSCore.framework/TNSCore of architectures: i386 x86_64 bitcode

With bitcode present in the list of "stripped architectures", the Export step for this archive should no longer have the issue described above by @tylerablake.

@KristianDD KristianDD modified the milestones: 6.1.1, 6.1.2 Sep 17, 2019
@klaask
Copy link

klaask commented Sep 20, 2019

Same error here - archiving works with nativescript 5.2 and fails with 5.3 up to 6.1.2.
/usr/bin/xcrun /xxxxxx/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/fastlane-2.131.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/s9/9x222qjd6mzbqn70v0j57c200000gr/T/gym_config20190918-69270-1jt0suo.plist' -archivePath /xxxxxx/Library/Developer/Xcode/Archives/2019-09-18/xxxxxx\ 2019-09-18\ 08.18.19.xcarchive -exportPath '/var/folders/s9/9x222qjd6mzbqn70v0j57c200000gr/T/gym_output20190918-69270-7p2e8o' xcodebuild -exportArchive -exportOptionsPlist /var/folders/s9/9x222qjd6mzbqn70v0j57c200000gr/T/gym_config20190918-69270-1jt0suo.plist -archivePath '/xxxxxx/Library/Developer/Xcode/Archives/2019-09-18/xxxxxx 2019-09-18 08.18.19.xcarchive' -exportPath /var/folders/s9/9x222qjd6mzbqn70v0j57c200000gr/T/gym_output20190918-69270-7p2e8o error: exportArchive: Failed to verify bitcode in TNSWidgets.framework/TNSWidgets: error: Bundle only contains bitcode-marker /var/folders/s9/9x222qjd6mzbqn70v0j57c200000gr/T/XcodeDistPipeline.~~~BKx5rr/Root/Payload/xxxxxx.app/Frameworks/TNSWidgets.framework/TNSWidgets (armv7) ** EXPORT FAILED ** Exit status: 70

@klaask
Copy link

klaask commented Sep 27, 2019

Recent xcode update has fixed this error on our side.

@Fatme
Copy link
Contributor

Fatme commented Sep 30, 2019

Hey guys,

I was able to reproduce the issue using Xcode 10. The error that pop ups is a really strange as we've disabled bitcode inside .pbxproj as can be seen here. According to the error it seems Xcode thinks bitcode is enabled for the application and complains that TNSWidgets.framework is without bitcode.

However, I was able to reproduce the error with brand new iOS application created from Xcode that has embedded framework. So, it seems as issue in Xcode 10 itself in case when non-App Store distribution method is used (in my case Ad Hoc distribution) and application has embedded framework.

As @klaask mentioned, the issue is not reproduced with Xcode 11, it seems as resolved.

So, @jpakulski, @SephReed, @keithgulbro, @tylerablake, @facetious, @cerealexx can you please check on your side if the issue is resolved with official Xcode 11?

PS: @facetious: The strip-dynamic-framework-architectures.sh file is located inside ios runtime repo. It is included in platforms directory when the native platform is added and is executed as post build step while building the application.

@SephReed
Copy link

I haven't had this problem for a while and can't say when it changed or why. Sorry :/

@jpakulski
Copy link
Author

All seems well on our side when using the Xcode 11.

@Fatme
Copy link
Contributor

Fatme commented Oct 7, 2019

I'm closing this issue as it seems resolved with latest official Xcode 11. Feel free to open an another issue in case you still have problems with bitcode while uploading.

@Fatme Fatme closed this as completed Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Describes issues related to build operations needs more info os: ios
Projects
None yet
Development

No branches or pull requests