Why to fix "Frameworks/Flutter.framework: Permission denied" while building iOS native app with flutter module?

3,982

Locate xcode_backend.sh file in the Flutter folder at this path ‎⁨flutter/packages⁩/flutter_tools/⁨bin⁩ and at line 140 change it to

    RunCommand find "${derived_dir}/engine/Flutter.framework" -type f -iname '.h' -exec chmod a-w "{}" \;

This will do it !!

Share:
3,982
wannamit
Author by

wannamit

Updated on December 14, 2022

Comments

  • wannamit
    wannamit over 1 year

    I created an iOS single view app (hostapp) and converted it to pod workspace. Runs well. Then created flutter module (clientapp), provided iOS team. Runs well, independently. Turned off Bitcode for hostapp and clientapp, as it caused other problems. Now added clientapp to hostapp via podfile, no internal code changes. After pod install in hostapp, I tried building it. Then it throws /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework: Permission denied

    • Both hostapp and clientapp are default iOS and flutter app. No changes whatsoever.
    • I followed this official guide https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps.
    • Have tried to search for similar issue but no success there.
    • Tested on Xcode 10 and 11
    • Tried legacy build
    • Tried Xcode 11, 10, 9.3-compatible, etc
    • Changed flutter chmod to 777
    • Changed /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/ chmod to 777
    PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Intermediates.noindex/hostapp.build/Debug-iphonesimulator/hostapp.build/Script-4899A4A5D85C0D737A68EFD6.sh (in target 'hostapp' from project 'hostapp')
        cd /Users/iVoIP/projects/xcode/hostapp
        /bin/sh -c /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Intermediates.noindex/hostapp.build/Debug-iphonesimulator/hostapp.build/Script-4899A4A5D85C0D737A68EFD6.sh
    
    mkdir -p /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks
    rsync --delete -av --filter P .*.?????? --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/iVoIP/projects/xcode/hostapp/Pods/../../clientapp/.ios/Flutter/engine/Flutter.framework" "/Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks"
    building file list ... done
    Flutter.framework/
    Flutter.framework/Flutter
    Flutter.framework/Info.plist
    Flutter.framework/icudtl.dat
    Flutter.framework/_CodeSignature/
    Flutter.framework/_CodeSignature/CodeResources
    
    sent 94440038 bytes  received 120 bytes  188880316.00 bytes/sec
    total size is 94428117  speedup is 1.00
    Stripped /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework/Flutter of architectures: armv7 arm64
    Code Signing /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework with Identity -
    /usr/bin/codesign --force --sign -  --preserve-metadata=identifier,entitlements '/Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework'
    /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework: replacing existing signature
    /Users/iVoIP/Library/Developer/Xcode/DerivedData/hostapp-czxdwjjefjvrnhhdvbmaqeczngbh/Build/Products/Debug-iphonesimulator/hostapp.app/Frameworks/Flutter.framework: Permission denied
    Command PhaseScriptExecution failed with a nonzero exit code