[go: nahoru, domu]

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

Clarify Flavor docs about how to configure iOS Xcode project #8743

Open
Tracked by #9976 ...
fras2560 opened this issue Apr 12, 2023 · 11 comments
Open
Tracked by #9976 ...

Clarify Flavor docs about how to configure iOS Xcode project #8743

fras2560 opened this issue Apr 12, 2023 · 11 comments
Assignees
Labels
dev.deployment Relates to deploying Flutter app section of Flutter.dev dev.flavors Relates to flavor configuration for deployment e1-hours Effort: < 8 hrs ed.xcode Relates to the XCode IDE fix.code-sample Needs new or updated code sample p2-medium Necessary but not urgent concern. Resolve when possible. st.triage.ltw Indicates Lead Tech Writer has triaged target.iOS Target apps on the iOS Platform

Comments

@fras2560
Copy link
fras2560 commented Apr 12, 2023

Steps to reproduce

Created an app with three different flavors
Add firebase plugins using different pods
Updated the app version and build number
Create IPA or run the app with different flavor

Expected results

Able to run or build the IPA for iOS.

Actual results

Unable to use

flutter run --dart-define=IsStudentApp=true --flavor student
Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        10.9s
Xcode build done.                                           37.6s
Unable to install
/Users/dallasfraser_local/Knowledgehook/MobileApps/mobileapp/build/ios/iphonesim
ulator/Knowledgehook Student Dev.app on 06F2DCCE-6E63-409B-8FB0-0DAA017D04D8.
This is sometimes caused by a malformed plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command (domain=NSPOSIXErrorDomain,
code=22):
Failed to install the requested application
The application's Info.plist does not contain a valid CFBundleVersion.
Ensure your bundle contains a valid CFBundleVersion.
  Command: xcrun simctl install 06F2DCCE-6E63-409B-8FB0-0DAA017D04D8
  /Users/dallasfraser_local/Knowledgehook/MobileApps/mobileapp/build/ios/iphones
  imulator/Knowledgehook Student Dev.app
Error launching application on iPhone 14 Pro Max.

also this shows it not being set

flutter build ipa  --dart-define=IsStudentApp=true --flavor student
┌─ App Settings ─────────────────────────────────────────────────────────┐
│ Version Number: Missing                                                │
│ Build Number: Missing                                                  │
│ Display Name: Knowledgehook for Student                                │
│ Deployment Target: 12.0                                                │
│ Bundle Identifier: com.knowledgehook.mobileapp.student                 │
│                                                                        │
│ You must set up the missing settings.                                  │
│                                                                        │
│ Warning: App icon is set to the default placeholder icon. Replace with │
│ unique icons.                                                          │
│                                                                        │
│ To update the settings, please refer to                                │
│ https://docs.flutter.dev/deployment/ios                                │
└────────────────────────────────────────────────────────────────────────┘

Code sample

Code sample Snippet of Info.plist
	<key>CFBundleShortVersionString</key>
	<string>$(FLUTTER_BUILD_NAME)</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>$(FLUTTER_BUILD_NUMBER)</string>

Snippet Generated.xcconfig

FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1

Screenshots or Video

Screenshots / Video demonstration

Logs

Logs
┌─ App Settings ─────────────────────────────────────────────────────────┐
│ Version Number: Missing                                                │
│ Build Number: Missing                                                  │
│ Display Name: Knowledgehook for Student                                │
│ Deployment Target: 12.0                                                │
│ Bundle Identifier: com.knowledgehook.mobileapp.student                 │
│                                                                        │
│ You must set up the missing settings.                                  │
│                                                                        │
│ Warning: App icon is set to the default placeholder icon. Replace with │
│ unique icons.                                                          │
│                                                                        │
│ To update the settings, please refer to                                │
│ https://docs.flutter.dev/deployment/ios                                │
└────────────────────────────────────────────────────────────────────────┘

Flutter Doctor output

Doctor output
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.9, on macOS 13.3 22E252 darwin-x64, locale
    en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.77.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.
@fras2560
Copy link
Author

The only thing I am not sure about is
https://docs.flutter.dev/deployment/flavors#plugin-configurations

This documentation talks about making changes to podfile. However, it is not clear at all how to make this change with multiple flavors or why it is needed.

No online tutorials talk about this either.

@fras2560
Copy link
Author

I was able to resolve the issue with this:

https://stackoverflow.com/a/73572386

If anyone can document these changes in flavor documentation and explain the issue that would be appreciated. Should generated be in parent runner or child runner?
https://i.stack.imgur.com/atgcJ.png

@darshankawar darshankawar added the st.triage.triage-team Triage team reviewing and categorizing the issue label Apr 13, 2023
@darshankawar
Copy link
Member

Thanks for the report @fras2560

I was able to resolve the issue with this:

https://stackoverflow.com/a/73572386

This link says to I was able to have it update again after setting it to the Generated.xcconfig file., ie, you need to make sure your flavor configuration is actually using that xcconfig. For it, see if this helps in your case or not.

@darshankawar
Copy link
Member

/cc @leighajarett for visibility. Since you are actively working on improving flavors documentation and use cases in Flutter :)

For your reference: #8743 and #8743

@fras2560
Copy link
Author

Thanks for the report @fras2560

I was able to resolve the issue with this:
https://stackoverflow.com/a/73572386

This link says to I was able to have it update again after setting it to the Generated.xcconfig file., ie, you need to make sure your flavor configuration is actually using that xcconfig. For it, see if this helps in your case or not.

What about cases where you have a pod file? What order should they be in? Or was the pod file missing something where it should already include the generated file?
image

@darshankawar
Copy link
Member

Thanks for the update. I'll keep this issue open for documentation to answer the queries raised here:

#8743
#8743
#8743

@darshankawar darshankawar added d: api docs and removed st.triage.triage-team Triage team reviewing and categorizing the issue labels Apr 14, 2023
@jmagman
Copy link
Member
jmagman commented Apr 17, 2023

What about cases where you have a pod file? What order should they be in? Or was the pod file missing something where it should already include the generated file? image

In that screenshot your prod and staging targets are using the Generated.xcconfig base configuration (it's overriding the Pods- one you set at the project-level). Technically it should be Release.xcconfig but all that's doing is #includeing the Generated.xcconfig. As the docs say:

 Note: Your configurations should be based on your Debug.xconfig or Release.xcconfig file, not the Pods-Runner.xcconfigs. You can check this by expanding the configuration names.

Ideally we would have a screenshot of that in step 3 similar to the one linked: flutter/flutter#82183 (comment)

@fras2560
Copy link
Author

@jmagman
"""
As the docs say:
"""
As what docs say?

@jmagman
Copy link
Member
jmagman commented Apr 17, 2023

As what docs say?

Should have linked it: https://docs.flutter.dev/deployment/flavors#creating-flavors-in-ios. The blue box has the note.

@fras2560
Copy link
Author

@jmagman
Can you explain this part of the docs? In particular if there is multiple flavors?
https://docs.flutter.dev/deployment/flavors#plugin-configurations

@jmagman
Copy link
Member
jmagman commented Apr 17, 2023

Example with paid and free flavors:
https://github.com/flutter/flutter/blob/67a84e6c8722b262dea6fb50a4043543b7a4c199/dev/integration_tests/flavors/ios/Podfile#L7-L12

I'm going to move this to the website issue tracker since this is a request for improving that documentation.

@jmagman jmagman transferred this issue from flutter/flutter Apr 17, 2023
@jmagman jmagman changed the title iOS - Seems like FLUTTER_BUILD_NUMBER is not being set correctly Flavor docs are unclear about how to configure Xcode project Apr 17, 2023
@jmagman jmagman changed the title Flavor docs are unclear about how to configure Xcode project Flavor docs are unclear about how to configure iOS Xcode project Apr 17, 2023
@leighajarett leighajarett self-assigned this Apr 28, 2023
@atsansone atsansone added target.iOS Target apps on the iOS Platform and removed d: api docs labels May 17, 2023
@atsansone atsansone transferred this issue from flutter/website May 24, 2023
@atsansone atsansone added fix.code-sample Needs new or updated code sample and removed d: examples labels May 30, 2023
@atsansone atsansone changed the title Flavor docs are unclear about how to configure iOS Xcode project Clarify Flavor docs about how to configure iOS Xcode project Jun 2, 2023
@atsansone atsansone added p2-medium Necessary but not urgent concern. Resolve when possible. e1-hours Effort: < 8 hrs dev.deployment Relates to deploying Flutter app section of Flutter.dev labels Jun 2, 2023
@atsansone atsansone added st.triage.ltw Indicates Lead Tech Writer has triaged ed.xcode Relates to the XCode IDE dev.flavors Relates to flavor configuration for deployment labels Jun 2, 2023
@atsansone atsansone self-assigned this Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev.deployment Relates to deploying Flutter app section of Flutter.dev dev.flavors Relates to flavor configuration for deployment e1-hours Effort: < 8 hrs ed.xcode Relates to the XCode IDE fix.code-sample Needs new or updated code sample p2-medium Necessary but not urgent concern. Resolve when possible. st.triage.ltw Indicates Lead Tech Writer has triaged target.iOS Target apps on the iOS Platform
Projects
None yet
Development

No branches or pull requests

5 participants