Repository navigation
flutter build ios --release may use a debug Flutter.framework by mistake #37850
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: annoyanceRepeatedly frustrating issues with non-experimental functionalityRepeatedly frustrating issues with non-experimental functionalitya: buildBuilding flutter applications with the toolBuilding flutter applications with the toolcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.toolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
When I submit my application to Testflight I get the following error from Apple.
ITMS-90338: Non-public API usage - The app references non-public symbols in Frameworks/Flutter.framework/Flutter: _ptrace. If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed. For further information, visit the Technical Support Information at http://developer.apple.com/support/technical/
Best regards.
[✓] Flutter (Channel master, v1.8.4-pre.104, on Mac OS X 10.14.5 18F203, locale en-GB)
• Flutter version 1.8.4-pre.104 at /Users/laibullle/flutter
• Framework revision 61ede615c0 (2 days ago), 2019-08-06 03:51:25 -0400
• Engine revision a665c6fbd4
• Dart version 2.5.0 (build 2.5.0-dev.1.0 8cd01287b4)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/laibullle/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.6.1
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] Connected device (1 available)
• macOS • macOS • darwin-x64 • Mac OS X 10.14.5 18F203
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: annoyanceRepeatedly frustrating issues with non-experimental functionalityRepeatedly frustrating issues with non-experimental functionalitya: buildBuilding flutter applications with the toolBuilding flutter applications with the toolcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.toolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Activity
stuartmorgan-g commentedon Aug 8, 2019
ptraceshould only be compiled into debug builds; did you submit a debug build to Apple?bailleul-dev commentedon Aug 8, 2019
No, I did not explicitly submited any debug flag or something like that.
I fixed the issue in recreating my project from flutter stable, now it works.
sjindel-google commentedon Aug 8, 2019
@laibulle: I have double-checked that
_ptraceis not referenced by release builds ofFlutter.framework. Perhaps you copied the build after runningflutter run, which creates a debug build by default?The issue may re-appear the next time you upgrade Flutter if you're not using a release build.
bailleul-dev commentedon Aug 8, 2019
Yes I think I missed
flutter build ios --releaseTheunodb commentedon Aug 16, 2019
I'm having this issue as well. I made sure to clean everything and to run the correct build command.
Steps i took:
(In terminal)
Got a message from apple stating invalid binary.
The email stated:
ITMS-90338: Non-public API usage - The app references non-public symbols in Frameworks/Flutter.framework/Flutter: _ptrace.
` [✓] Flutter (Channel master, v1.9.1-pre.57, on Mac OS X 10.14.6 18G87, locale
en-ZA)
• Flutter version 1.9.1-pre.57 at /Users/td0810/flutter
• Framework revision 5a4d3cd (2 hours ago), 2019-08-16 01:57:36 -0400
• Engine revision c29c9bc
• Dart version 2.5.0 (build 2.5.0-dev.2.1 e35e8833ee)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/td0810/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Users/td0810/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/183.5692245/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
✗ CocoaPods installed but not initialized.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To initialize CocoaPods, run:
pod setup
once to finalize CocoaPods' installation.
[✓] Android Studio (version 3.4)
• Android Studio at /Users/td0810/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/183.5692245/Android
Studio.app/Contents
• Flutter plugin version 38.2.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build
1.8.0_152-release-1343-b01)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.2)
• IntelliJ at /Users/td0810/Applications/JetBrains Toolbox/IntelliJ IDEA
Ultimate.app
• Flutter plugin version 38.2.4
• Dart plugin version 192.6262.13
[!] Connected device
! No devices available
`
sjindel-google commentedon Aug 17, 2019
That's very strange. I cannot reproduce this issue.
Can you please try the following:
What output do you get?
Theunodb commentedon Aug 19, 2019
I followed the steps above. Couldn't find ptrace anywhere. Not sure why apple would still reject it. I switched to stable and managed to submit fine. Will switch back to master for the next release and try everything again. Thanks for your help anyway.
PS. This is the content of the package that failed:
https://gist.github.com/zanderso/6b1d7ee6180d752df17c63dfd3b6fe39
sjindel-google commentedon Aug 19, 2019
@Theunodb I'm sorry for my earlier mistake, could you actually provide the output of
nm Frameworks/Flutter.framework/Flutter(in the archive uploaded to Apple) instead?Theunodb commentedon Aug 20, 2019
Sorry for the delay. Running that command gave me:
U _ptrace U _ptracesjindel-google commentedon Aug 20, 2019
@Theunodb That's the problem. Release-builds of
Flutter.frameworkdo not have that symbol, I've confirmed locally.It appears that somehow you're still uploading a debug build.
An easy way to check that is to run the App from within Xcode (before Archiving it) and look for the "Debug" banner on the top-right (assuming you haven't done anything to remove it).
zanderso commentedon Aug 20, 2019
It sounds like @Theunodb may have hit a bug in which
flutter build ios --releaseuses a debugFlutter.frameworkby mistake. I will reopen and adjust the issue to reflect this.[-]ITMS-90338: Non-public API usage: Frameworks/Flutter.framework/Flutter: _ptrace[/-][+]flutter build ios --release may use a debug Flutter.framework by mistake[/+]85 remaining items
barrettbreshears commentedon Dec 18, 2019
Just thought I would add my doctor output since this is happening on the stable branch with v1.12.13
`Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.0)
[✓] Connected device (1 available)
• No issues found!`
jmagman commentedon Dec 18, 2019
barrettbreshears commentedon Dec 19, 2019
I was able to fix my environment. I think this must have been an update issue for me. I selected v1.9.1+hotfix.6 and then went back to latest stable channel. cleaned my build and removed my pods folder. just uploaded to app store and got the "The following build has completed processing: and ready for test flight email" . That was a huge pain, I was under a deadline and it sucks when the tools are working.
Is there any way we could get a document on the best way to remove and reinstall flutter if your system gets messed up?
matte5031 commentedon Jan 19, 2020
jmagman commentedon Jan 21, 2020
rajathk commentedon Jan 28, 2020
Any update on this? I have tried -
flutter clean
rm -rf ios/Flutter/Flutter.framework
flutter build ios --release
I have upgraded the flutter SDK too but no luck.
uzumaki258 commentedon Feb 6, 2020
In flutter 1.9.1 hot fix 5
I can do Product > Scheme > Edit Scheme > Run > Build Configuration: Release
And it work.
But in Flutter 1.12.13 it not work anymore.
Let me try this
rm -rf ios/Flutter/Flutter.framework
ch-muhammad-adil commentedon Feb 20, 2020
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.1 19B88, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Android Studio (version 3.5)
[✓] Connected device (1 available)
I am using stable version and I am facing same issue,
I have tried above solutions but nothing is working for me.
izinin commentedon Jul 29, 2020
It is sad to see this issue cannot be fixed for 2 years :( -- last year i also struggled to push my release build to Apple app store. I found quickest workaround -- just copy release Flutter.Framework to debug Flutter.Framework and then follow releasing procedure
make sure you use correct paths -- i have Flutter in my home directory
~/flutteri hope it will help you
jmagman commentedon Jul 29, 2020
I'm not sure why this is still happening. By default Archive uses the Release build configuration. You can see that yourself in Xcode with Product > Scheme > Edit Scheme then Archive

On every build, run, test, archive, etc. there's an Xcode build phase that runs the

xcode_backendscript that lives in the Flutter SDK. It's responsible for compiling your dart code.You can see this under your Runner target build settings > Build Phases > Run Script
That script decides which version of the Flutter framework to copy and embed in the app:
flutter/packages/flutter_tools/bin/xcode_backend.sh
Lines 72 to 80 in 0c3b0c5
So on archive,
$CONFIGURATIONwill beRelease(or you have flavors set up andFLUTTER_BUILD_MODEisrelease),build_modewill bereleaseandartifact_variantwill beios-release.Then it figures out where the framework will be copied from:
flutter/packages/flutter_tools/bin/xcode_backend.sh
Line 101 in 0c3b0c5
At this point
framework_pathshould be$FLUTTER_ROOT/bin/cache/artifacts/engine/ios-release.Then the script scorch earths the framework.
derived_diris${SOURCE_ROOT}/Flutter(soios/Flutterfrom your top-level Flutter project directory) at this point. Itrm -rfs the framework at${SOURCE_ROOT}/Flutter/Flutter.framework, then re-copies it from$FLUTTER_ROOT/bin/cache/artifacts/engine/ios-releaseto${SOURCE_ROOT}/Flutter. (This defeats Xcode's app delta attempts, and is partially why iOS compile and install times are slow--this framework is very large due to bitcode).flutter/packages/flutter_tools/bin/xcode_backend.sh
Lines 141 to 143 in 0c3b0c5
Then it calls into dart to compile your app code.
After the source is compiled,
xcode_backend.shis invoked again in the lastThin Binarybuild phase to thin, strip bitcode (if needed) embed, and codesign the Flutter.framework and your compiled dart App.framework.The script first
rsyncs the previously copied Flutter.framework from theRun Scriptbuild phase into your app's framework directory.flutter_ios_engine_folderis that same${SOURCE_ROOT}/Flutterdirectory where we copied the framework earlier.xcode_frameworks_diris${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}which is yourRunner.app/Frameworksdirectory:flutter/packages/flutter_tools/bin/xcode_backend.sh
Line 292 in 0c3b0c5
Note: If you are using any Flutter plugins, they will link against whatever version is in
Flutter/Flutter.frameworkbefore all the above logic, and CocoaPods handles that, not Flutter's tooling. That dependency runs before the Runner target's build phases, so the above copying happens after all that so it shouldn't matterIf you add

export VERBOSE_SCRIPT_LOGGING=1to the top of the script build phases right before thexcode_backend.shcall, you can play along at home and see the framework copy happen in your own build logs in the Report Navigator:Maybe someone reproducing this can tell us where this logic is falling down and copying
$FLUTTER_ROOT/bin/cache/artifacts/engine/ios/Flutter.frameworkinstead of$FLUTTER_ROOT/bin/cache/artifacts/engine/ios-release/Flutter.frameworkvictorykong commentedon Jun 17, 2021
github-actions commentedon Jul 31, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.