Skip to content
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

[Add2App IOS] Instant crash on MacOS12.0.1 xcode13.1 Library not loaded: @rpath/App.framework/App #92896

Closed
yanwei49 opened this issue Nov 2, 2021 · 39 comments
Labels
r: solved Issue is closed as solved

Comments

@yanwei49
Copy link

yanwei49 commented Nov 2, 2021

crash is run on the Device, but it is normal on the simulator,It is normal before upgrading MacOS.
current version:Swift version:5.5.1,xcode version:13.1,flutter version:2.5.3
crash:

  Referenced from: /private/var/containers/Bundle/Application/8699A097-28EB-4B42-8566-994E5EC45F52/ceshiss.app/ceshiss
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
@mamuseferha mamuseferha added the in triage Presently being triaged by the triage team label Nov 2, 2021
@mamuseferha
Copy link

Hi @yanwei49
Can you please provide your flutter doctor -v and a minimal complete reproducible code sample?
Thank you

@mamuseferha mamuseferha added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 2, 2021
@yanwei49
Copy link
Author

yanwei49 commented Nov 2, 2021

flutter doctor -v:

✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale
    zh-Hans-CN)
    • Flutter version 2.5.3 at /Users/***/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (3 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/***/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.1, Build version 13A1030d
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.61.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.27.0

[✓] Connected device (3 available)
    • “***”的 iPhone (mobile)      •***            • ios
      • iOS 14.7.1 18G82
    • iPhone 13 Pro Max (mobile) • 58A9B499-A057-44DC-B1D5-0E4839622795 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • Chrome (web)               • chrome                               •
      web-javascript • Google Chrome 95.0.4638.69

! Doctor found issues in 1 category.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 2, 2021
@yanwei49
Copy link
Author

yanwei49 commented Nov 2, 2021

@geGao123
Copy link

geGao123 commented Nov 2, 2021

crash is run on the Device, but it is normal on the simulator,It is normal before upgrading MacOS. current version:Swift version:5.5.1,xcode version:13.1,flutter version:2.5.3 crash: Referenced from: /private/var/containers/Bundle/Application/8699A097-28EB-4B42-8566-994E5EC45F52/ceshiss.app/ceshiss Reason: image not found dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

I have similar situation.
current version: xcode version:13.1, flutter version:2.6.0-12.0.pre.554, macOS 12.0.1
when i create a new ios project(swift),and add flutter module.run on the device and get this

crash:
Library not loaded: @rpath/App.framework/App
Referenced from: /private/var/containers/Bundle/Application/E9FD692D-A9A6-40FC-A1B3-4B1BD5121BC2/flutter_test.app/flutter_test
Reason: tried: '/usr/lib/swift/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/E9FD692D-A9A6-40FC-A1B3-4B1BD5121BC2/flutter_test.app/Frameworks/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/E9FD692D-A9A6-40FC-A1B3-4B1BD5121BC2/flutter_test.app/Frameworks/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/E9FD692D-A9A6-40FC-A1B3-4B1BD5121BC2/flutter_test.app/Frameworks/App.framework/App' (no such file), '/usr/lib/swift/App.framework/App' (no such file), '/private/var/containers/Bundle/Application/E9FD692D-A9A6-40FC-A1B3-4B1BD5121BC2/flutter_test.app/Frameworks/App.framework/App' (no such file), 
'/private/var/containers/Bundle/Application/E9FD692D-A9A6-40FC-A1B3-4B1BD5121BC2/flutter_test.app/Frameworks/App.framework/App' (no such file), '/private/
flutter doctor -v:
[✓] Flutter (Channel master, 2.6.0-12.0.pre.554, on macOS 12.0.1 21A559 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.6.0-12.0.pre.554 at /Users/timmy/Documents/sdk/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6e0ba60408 (3 hours ago), 2021-11-02 03:48:04 -0400
    • Engine revision c674d2cbc6
    • Dart version 2.15.0 (build 2.15.0-268.0.dev)
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/timmy/Documents/sdk/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/timmy/Documents/sdk/Android/sdk
    • Java binary at: /Users/timmy/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

@maheshmnj
Copy link
Member

maheshmnj commented Nov 3, 2021

@yanwei49 are you trying to add flutter to an existing ios app? if yes can you please refer the add to app docs and share which option are you using Option A, B or C?

Thanks

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 3, 2021
@maheshmnj
Copy link
Member

@geGao123 The error you are hitting seems different than the one reported here, I would advise you to please file a separate issue by filling in the details requested in the issue template.

Thanks

@yanwei49
Copy link
Author

yanwei49 commented Nov 3, 2021

@yanwei49 are you trying to add flutter to an existing ios app? if yes can you please refer the add to app docs and share which option are you using Option A, B or C?

Thanks

I use A,It is normal before upgrading the macOS system and xcode.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 3, 2021
@Aflysun
Copy link

Aflysun commented Nov 3, 2021

I had the same problem, also use A ,😭

@maheshmnj maheshmnj changed the title Instant crash on MacOS12.0.1 xcode13.1 Library not loaded: @rpath/App.framework/App [Add2App IOS] Instant crash on MacOS12.0.1 xcode13.1 Library not loaded: @rpath/App.framework/App Nov 3, 2021
@maheshmnj
Copy link
Member

maheshmnj commented Nov 3, 2021

@yanwei49 @Aflysun I tried running this add to app sample and it's working fine for me on macOS 12.0.1 with xcode 13, so this is likely not an issue with macOS version or Xcode version, Can you please share a complete project for us to have a look.

flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale en-GB)
    • Flutter version 2.5.3 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (3 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 60.1.4
    • Dart plugin version 212.5080.8

[✓] VS Code (version 1.61.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (3 available)
    • iPhone 12 Pro (mobile) • B622CBB7-F906-4FA7-8F49-FACEAAC905AB • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 95.0.4638.69

• No issues found!

Thanks

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 3, 2021
@geGao123
Copy link

geGao123 commented Nov 3, 2021

@yanwei49 @Aflysun I tried running this add to app sample and it's working fine for me on macOS 12.0.1 with xcode 13, so this is likely not an issue with macOS version or Xcode version, Can you please share a complete project for us to have a look.

flutter doctor -v
Thanks

try xcode13.1

@kxifenger
Copy link

I had the same problem, also use A

@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

@yanwei49 @Aflysun I tried running this add to app sample and it's working fine for me on macOS 12.0.1 with xcode 13, so this is likely not an issue with macOS version or Xcode version, Can you please share a complete project for us to have a look.
flutter doctor -v
Thanks

try xcode13.1

demo link:https://gitee.com/yanwei49/flutterdemo

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 4, 2021
@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

I tried running this add to app sample

I tried running this add to app sample and it's working crash for me xcode13.1:
dyld: Library not loaded: @rpath/App.framework/App
Referenced from: /private/var/containers/Bundle/Application/4786695F-BCC3-4225-9798-E57587DBF124/IOSFullScreen.app/IOSFullScreen
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

@yanwei49 @Aflysun I tried running this add to app sample and it's working fine for me on macOS 12.0.1 with xcode 13, so this is likely not an issue with macOS version or Xcode version, Can you please share a complete project for us to have a look.
flutter doctor -v
Thanks

try xcode13.1

I tried xcode12.5,xcode13, xcode13.1 , but I couldn't

@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

@yanwei49 @Aflysun I tried running this add to app sample and it's working fine for me on macOS 12.0.1 with xcode 13, so this is likely not an issue with macOS version or Xcode version, Can you please share a complete project for us to have a look.

flutter doctor -v
Thanks

Is it related to Apple M1?My computer is Apple Mini macOS13.0.1

@Aflysun
Copy link

Aflysun commented Nov 4, 2021

My xcode version 13.1 , I suspect it's the Xcode version ,I'll try the lower xcode version.

@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

My xcode version 13.1 , I suspect it's the Xcode version ,I'll try the lower xcode version.

It's not a problem with the Xcode version, i tried xcode12.5,xcode13,xcode13.1

@kxifenger
Copy link

kxifenger commented Nov 4, 2021

i find a way to solve this problem.
9906E9B3-E596-4371-BC17-01A43303ADFB
find the pods-XXX-frameworks.sh file and add the
install_framework "${PODS_ROOT}/../../flutter-camera-ui/.ios/Flutter/App.framework" in Debug and Release branch seperately (remember change your App.framework path)
but i do not know why appear this problem, if someone know why please tell me.

@Aflysun
Copy link

Aflysun commented Nov 4, 2021

@maheshmnj

flutter doctor -v
[✓](Channel master, 2.6.0-12.0.pre.535, on macOS 12.0.1 21A559
darwin-arm, locale zh-Hans-CN)
• Flutter version 2.6.0-12.0.pre.535 at /Users/chenxiaoguang/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 04156b6 (5 days ago), 2021-10-29 18:29:31 -0700
• Engine revision 3a0a63c
• Dart version 2.15.0 (build 2.15.0-262.0.dev)
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[!] Android Studio (not installed)
• Android Studio not found; download from
https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).

[✓] VS Code (version 1.61.2)
• VS Code at /Users/chenxiaoguang/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0

[✓] Connected device (3 available)
• iPhone19 (mobile) • 00008030-000535A92E43802E • ios
• iOS 14.8 18H17
• iPhone 12 Pro (mobile) • DE43A4A7-0380-4A58-B1E3-9BCCE74BA976 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 95.0.4638.69

! Doctor found issues in 2 categories.

@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

i find a way to solve this problem. 9906E9B3-E596-4371-BC17-01A43303ADFB find the pods-XXX-frameworks.sh file and add the install_framework "${PODS_ROOT}/../../flutter-camera-ui/.ios/Flutter/App.framework" in Debug and Release branch seperately (remember change your App.framework path) but i do not know why appear this problem, if someone know why please tell me.

i tried It did solve the problem, thanks!

@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

@yanwei49 @Aflysun I tried running this add to app sample and it's working fine for me on macOS 12.0.1 with xcode 13, so this is likely not an issue with macOS version or Xcode version, Can you please share a complete project for us to have a look.

flutter doctor -v
Thanks

It did solve the problem, Look at kxifenger's solution, But can you tell us why this is done?

@Aflysun
Copy link

Aflysun commented Nov 4, 2021

@yanwei49 @kxifenger
By doing so, the problem is solved, but what ?😄

@maheshmnj
Copy link
Member

I tried running this add to app sample and it's working crash for me xcode13.1:

@yanwei49 @Aflysun, I did try running with Xcode 13.1 and the ios module runs fine in Xcode.

demo link:https://gitee.com/yanwei49/flutterdemo

Even this application builds successfully.

Please make sure you are running the .xcworkspace file, You can find the steps to run the application in the readme of sample app

@maheshmnj maheshmnj added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 4, 2021
@yanwei49
Copy link
Author

yanwei49 commented Nov 4, 2021

I tried running this add to app sample and it's working crash for me xcode13.1:

@yanwei49 @Aflysun, I did try running with Xcode 13.1 and the ios module runs fine in Xcode.

demo link:https://gitee.com/yanwei49/flutterdemo

Even this application builds successfully.

Please make sure you are running the .xcworkspace file, You can find the steps to run the application in the readme of sample app

I tried running this add to app sample and it's working crash for me xcode13.1, But now the problem has been solved, The solution is provided by @kxifenger , But can you tell us why this is done?

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 4, 2021
@maheshmnj
Copy link
Member

maheshmnj commented Nov 4, 2021

The solution is provided by @kxifenger , But can you tell us why this is done?

@yanwei49 I am not really sure why it worked.

But now the problem has been solved

Provided you last message I feel it's safe to close the issue, If you disagree feel free to write in the comments and I will reopen it.

@maheshmnj maheshmnj added r: solved Issue is closed as solved and removed in triage Presently being triaged by the triage team labels Nov 4, 2021
@WeMadeCode
Copy link

I had the same problem, also use A

@WeMadeCode
Copy link

I have try to the macOS big Sur 11.3.1 + Xcode 13.1 and it's OK。But crashed in macOS Monterey 12.0.1 + Xcode 13.1. I suspect it has something to do with the system

@WeMadeCode
Copy link

I tried running this add to app sample and it's working crash for me xcode13.1:

@yanwei49 @Aflysun, I did try running with Xcode 13.1 and the ios module runs fine in Xcode.

demo link:https://gitee.com/yanwei49/flutterdemo

Even this application builds successfully.

Please make sure you are running the .xcworkspace file, You can find the steps to run the application in the readme of sample app

@maheshmnj Why don't you try it on macOS Monterey 12.0.1

@maheshmnj
Copy link
Member

@WeMadeCode I did please check flutter doctor #92896 (comment)

@WeMadeCode
Copy link

[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale zh-Hans-CN)
• Flutter version 2.5.3 at /Users/xxx/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 1811693 (3 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/xxx/Library/Android/sdk
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.1, Build version 13A1030d
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.62.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.28.0

[✓] Connected device (2 available)
• iPhone (mobile) • 29a8d86ade875cec173ae3573439551cced781cd • ios • iOS 15.0.2 19A404
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
! Error: iPhone is not connected. Xcode will continue when iPhone is connected. (code -13)

@maheshmnj

@yeatse
Copy link
Contributor

yeatse commented Nov 12, 2021

Same problem here on macOS 12.0.1 & Xcode 13.1.

After some investigations, I found that when building on macOS Monterey, two new load commands (LC_DYLD_EXPORTS_TRIE & LD_DYLD_CHAINED_FIXUPS) are inserted into App.framework, which makes the old version of ruby-macho not so happy.

Problem disappeared after upgrading cocoapods to 1.11.0 and ruby-macho to 2.5.1. See CocoaPods/CocoaPods#10390

@DayuEJ
Copy link

DayuEJ commented Nov 26, 2021

Please try update ruby and Cocoapods to latest version. can fix it. This problem make me feel sick. it wasted my day.......fuck!!!! good luck!!!!

@ManuelOrtegaSSU
Copy link

Same problem here on macOS 12.0.1 & Xcode 13.1.

After some investigations, I found that when building on macOS Monterey, two new load commands (LC_DYLD_EXPORTS_TRIE & LD_DYLD_CHAINED_FIXUPS) are inserted into App.framework, which makes the old version of ruby-macho not so happy.

Problem disappeared after upgrading cocoapods to 1.11.0 and ruby-macho to 2.5.1. See CocoaPods/CocoaPods#10390

This is working for me!! Thank you very much!

@iamjjh
Copy link

iamjjh commented Dec 7, 2021

sudo gem update ruby-macho
This is working for me

@talzemingo
Copy link

Thanks iamjjh
sudo gem update ruby-macho
Works for me also

@somepark
Copy link

sudo gem update ruby-macho
It's OK,Thank you!

@AshineReal
Copy link

Same problem here on macOS 12.0.1 & Xcode 13.1.

After some investigations, I found that when building on macOS Monterey, two new load commands (LC_DYLD_EXPORTS_TRIE & LD_DYLD_CHAINED_FIXUPS) are inserted into App.framework, which makes the old version of ruby-macho not so happy.

Problem disappeared after upgrading cocoapods to 1.11.0 and ruby-macho to 2.5.1. See CocoaPods/CocoaPods#10390

This is right correctly solution for this problem !!!

@AshineReal
Copy link

i find a way to solve this problem. 9906E9B3-E596-4371-BC17-01A43303ADFB find the pods-XXX-frameworks.sh file and add the install_framework "${PODS_ROOT}/../../flutter-camera-ui/.ios/Flutter/App.framework" in Debug and Release branch seperately (remember change your App.framework path) but i do not know why appear this problem, if someone know why please tell me.

it because , you fix procedure where really error lead to.

let's check right procedure , that should be.
podhelper.rb file which your project's podfile reference .

def install_flutter_application_pod(flutter_application_path)
  current_directory_pathname = Pathname.new File.expand_path('..', __FILE__)
  app_framework_dir = File.expand_path('App.framework', current_directory_pathname.to_path)
  app_framework_dylib = File.join(app_framework_dir, 'App')
  if !File.exist?(app_framework_dylib)
    # Fake an App.framework to have something to link against if the xcode backend script has not run yet.
    # CocoaPods will not embed the framework on pod install (before any build phases can run) if the dylib does not exist.
    # Create a dummy dylib.
    FileUtils.mkdir_p(app_framework_dir)
    `echo "static const int Moo = 88;" | xcrun clang -x c -dynamiclib -o "#{app_framework_dylib}" -`
  end

  # Keep pod and script phase paths relative so they can be checked into source control.
  # Process will be run from project directory.

  # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
  project_directory_pathname = defined_in_file.dirname
  relative = current_directory_pathname.relative_path_from project_directory_pathname
  pod 'xxxx_flutter', :path => relative.to_s, :inhibit_warnings => true

  flutter_export_environment_path = File.join('${SRCROOT}', relative, 'flutter_export_environment.sh');
  script_phase :name => 'Run Flutter Build xxxx_flutter Script',
    :script => "set -e\nset -u\nsource \"#{flutter_export_environment_path}\"\nexport VERBOSE_SCRIPT_LOGGING=1 && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build",
    :execution_position => :before_compile
end

it insert a build phase (Run Flutter Build xxxx_flutter Script) before compile ,
it run other script which can be found in FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.dart
notice params 'build'
func buildApp() build the app.framework and make it into your_flutter_project/.ios/Flutter directory.

then Embed Pods Frameworks script should embed app.framework which build last step. (which the script is generated by pod install)

final your flutter project is build & embed into your ios host project.

Now error comes from pod install , where ruby-macho could not recognize new mach load command . detail see ref:#92896 (comment)

so Pods-xxxx-frameworks generated with error effect install_framework line , that 's no app.framework path mention on it !!!

your fix solution mention the app.framework path , app.framework can be found and embed into your ios host project.

hope it clear to solve your question.

@github-actions
Copy link

github-actions bot commented Jan 5, 2022

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 -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: solved Issue is closed as solved
Projects
None yet
Development

No branches or pull requests