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

Ensure iOS app extension builds with XCode 15 #135056

Open
Tracked by #124287
cyanglaz opened this issue Sep 19, 2023 · 13 comments
Open
Tracked by #124287

Ensure iOS app extension builds with XCode 15 #135056

cyanglaz opened this issue Sep 19, 2023 · 13 comments
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@cyanglaz
Copy link
Contributor

cyanglaz commented Sep 19, 2023

part of #124287

When building iOS app extension with XCode 15, an error has shown:


Showing All Messages
Cycle inside Runner; building could produce unreliable results.
Cycle details:
→ Target 'Runner': ExtractAppIntentsMetadata
○ Target 'Runner' has copy command from '/Users/ychris/Library/Developer/Xcode/DerivedData/Runner-ezvtmtjulscpwdbkciycnelbyryh/Build/Products/Debug-iphoneos/FlutterShare.appex' to '/Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/PlugIns/FlutterShare.appex'
○ That command depends on command in Target 'Runner': script phase “Thin Binary”
○ Target 'Runner' has process command with output '/Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/Info.plist'
○ Target 'Runner' has copy command from '/Users/ychris/Library/Developer/Xcode/DerivedData/Runner-ezvtmtjulscpwdbkciycnelbyryh/Build/Products/Debug-iphoneos/FlutterShare.appex' to '/Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/PlugIns/FlutterShare.appex'


Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: /Users/ychris/Library/Developer/Xcode/DerivedData/Runner-ezvtmtjulscpwdbkciycnelbyryh/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Objects-normal/arm64/ExtractedAppShortcutsMetadata.stringsdata ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:ExtractAppIntentsMetadata ->

node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-copy-files> ->

command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase4-copy-files ->

node: <Copy /Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/PlugIns/FlutterShare.appex> ->

CYCLE POINT ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:Copy /Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/PlugIns/FlutterShare.appex /Users/ychris/Library/Developer/Xcode/DerivedData/Runner-ezvtmtjulscpwdbkciycnelbyryh/Build/Products/Debug-iphoneos/FlutterShare.appex ->

node: <target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase3-thin-binary> ->

command: P0:::Gate target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49--fused-phase3-thin-binary ->

node: <execute-shell-script-18c1723432283e0cc55f10a6dcfd9e02f1eee2015e8ff5ebcd27678f788c2826-target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-> ->

command: P2:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:PhaseScriptExecution Thin Binary /Users/ychris/Library/Developer/Xcode/DerivedData/Runner-ezvtmtjulscpwdbkciycnelbyryh/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-3B06AD1E1E4923F5004D2608.sh ->

node: /Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/Info.plist ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:ProcessInfoPlistFile /Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/Info.plist /Users/ychris/tmp/test_extension/ios/Runner/Info.plist ->

node: /Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/PlugIns/FlutterShare.appex ->

command: P0:target-Runner-18c1723432283e0cc55f10a6dcfd9e0288a783a885d8b0b3beb2e9f90bde3f49-:Debug:Copy /Users/ychris/tmp/test_extension/build/ios/Debug-iphoneos/Runner.app/PlugIns/FlutterShare.appex /Users/ychris/Library/Developer/Xcode/DerivedData/Runner-ezvtmtjulscpwdbkciycnelbyryh/Build/Products/Debug-iphoneos/FlutterShare.appex

This error prevents Flutter from supporting app extension for iOS 17 and above.

@cyanglaz cyanglaz added engine flutter/engine repository. See also e: labels. P1 High-priority issues at the top of the work list team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Sep 19, 2023
@cyanglaz cyanglaz self-assigned this Sep 19, 2023
@cyanglaz cyanglaz added the platform-ios iOS applications specifically label Sep 19, 2023
@cyanglaz cyanglaz removed the engine flutter/engine repository. See also e: labels. label Sep 19, 2023
@cyanglaz
Copy link
Contributor Author

cyanglaz commented Sep 19, 2023

Workaround: In XCode, moving the "Embed Foundation Extensions" build phase to above "Run Script" solved the issue.

At the moment, I'm not sure if there is anything Flutter can do to prevent this.

@cyanglaz cyanglaz added P2 Important issues not at the top of the work list and removed P1 High-priority issues at the top of the work list labels Sep 19, 2023
@Rexios80
Copy link
Contributor

This order works for me with an embedded watch app:

Screenshot 2023-09-26 at 12 13 47 PM

@cyanglaz cyanglaz removed their assignment Sep 26, 2023
@cyanglaz
Copy link
Contributor Author

I'm not actively working on this since there is an easy workaround.

@afelipe00
Copy link

The change of "Embed Foundation Extensions" worked for me, but is there any reason why it happens? can it affect the performance of my app?

@afelipe00
Copy link

since I applied the above mentioned solution, the flutter project started to create a build folder inside the ios folder, does anyone know why this is happening? how can I fix it?

Screenshot 2023-09-27 at 1 28 27 PM

without realizing it I made a commit but today while detailing I realized the existence of this folder that was not there before.

@whitesoil
Copy link

whitesoil commented Sep 30, 2023

I solved in this order. #135739

@45online
Copy link

I re-downloaded xcode 14.3 and run it with the following command line.
/Applications/Xcode14.3.app/Contents/MacOS/Xcode --help

@litang0908
Copy link

This orders works for me.

image

littleGnAl added a commit to AgoraIO-Extensions/Agora-Flutter-SDK that referenced this issue Nov 1, 2023
The user reports that it's failed to build the example with xcode 15
```
Error (Xcode): Cycle inside Runner; building could produce unreliable results.
Cycle details:
→ Target 'Runner': CodeSign /Users/joepritchard/Downloads/Agora-Flutter-SDK-main/example/build/ios/Debug-iphoneos/Runner.app

...
```
To fix it, we need to change the order in `Build Phases`. See 
- flutter/flutter#135739
-
flutter/flutter#135056 (comment)

I added a new job to cover this case and retained the old `build_ios`
job to ensure this change does not affect the user with xcode version <
15.
@steveroseik
Copy link

This order works for me with an embedded watch app:

Screenshot 2023-09-26 at 12 13 47 PM

WOOWW, THANK YOU!
Other solution were long and useless

@rr8733380
Copy link

What could be wrong if I have everything molested like this. Why does it not work?

Снимок экрана 2024-01-28 в 01 18 52

@NM4ik
Copy link

NM4ik commented Feb 12, 2024

@dam-ease

#142907 My issue was closed by addressing it to related issues, but the problem is that I did all the suggested solutions, but I still get the error

I created a test project and added a notification service extension to xCode. I changed the build phases there in the order of the queue and attach a screenshot.
image

But I still get an error when building on a physical device. I have no idea at all how to solve it, because on my second computer on m2 pro, the same project runs without problems

@dam-ease dam-ease added the customer: crowd Affects or could affect many people, though not necessarily a specific customer. label Feb 13, 2024
@jmagman
Copy link
Member

jmagman commented Mar 5, 2024

I updated the App Clip website to reflect the order needed for the build phases.

Drag Embedded App Clips to above Thin Binary.

https://github.com/flutter/website/pull/10145/files#r1489922511
https://docs.flutter.dev/platform-integration/ios/ios-app-clip#step-2---add-an-app-clip-target

This should also be done for https://docs.flutter.dev/platform-integration/ios/app-extensions

@NM4ik
Copy link

NM4ik commented Apr 28, 2024

#142907
#135056

Finally, I managed to install the application on a real device in --release mode and all the others and finally i can do archive for my app!

The problem of Command ValidateEmbeddedBinary failed with a nonzero exit code was solved for me, which was related to the NotificationService. Although it is strange that on my working mac mini m2 pro there were no problems with assembly, but on my home m2 macbook it was not possible in any way.

Apparently, xCode was updated and I was able to go to the error log and see the problem, although the error was not clickable before.

And so, I found such an offer there: "The CFBundleShortVersionString string of the application extensions (3.0.0) must match the string containing the parent application (3.0.5)."

I started searching the project for version 3.0.0 and found a match with MARKETING_VERSION. I found the MARKETING_VERSION code in my Notification Service, changed it to the desired product version 3.0.0 -> 3.0.5 and everything worked!
image

I do not know how this can happen at all, some kind of magic, I'm shocked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer: crowd Affects or could affect many people, though not necessarily a specific customer. P2 Important issues not at the top of the work list platform-ios iOS applications specifically team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
None yet
Development

No branches or pull requests