Home > Software engineering >  Flutter - Xcode can't see app packages while building for Simulator
Flutter - Xcode can't see app packages while building for Simulator

Time:01-31

Whenever I try running my app Xcode gives me this:

Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
lib/main.dart:1
Xcode build done.                                            9.9s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/4m/6ntf71vx17qfqdg9kr88s2s80000gn/T/flutter_tools.V6z5EC/flutter_ios_build_temp_dirX4Qj6c/temporary_xcresult_bundle
: Error: The getter 'payload' isn't defined for the class 'NotificationAppLaunchDetails'.
lib/main.dart:57
- 'NotificationAppLaunchDetails' is from 'package:flutter_local_notifications_platform_interface/src/types.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications_platform_interface-6.0.0/lib/src/types.dart').
package:flutter_local_notifications_platform_interface/src/types.dart:1
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'payload'.
        _orderID = (notificationAppLaunchDetails.payload != null &&
                                                 ^^^^^^^
: Error: The getter 'payload' isn't defined for the class 'NotificationAppLaunchDetails'.
lib/main.dart:58
- 'NotificationAppLaunchDetails' is from 'package:flutter_local_notifications_platform_interface/src/types.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications_platform_interface-6.0.0/lib/src/types.dart').
package:flutter_local_notifications_platform_interface/src/types.dart:1
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'payload'.
                notificationAppLaunchDetails.payload.isNotEmpty)
                                             ^^^^^^^
: Error: The getter 'payload' isn't defined for the class 'NotificationAppLaunchDetails'.
lib/main.dart:59
- 'NotificationAppLaunchDetails' is from 'package:flutter_local_notifications_platform_interface/src/types.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications_platform_interface-6.0.0/lib/src/types.dart').
package:flutter_local_notifications_platform_interface/src/types.dart:1
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'payload'.
            ? int.parse(notificationAppLaunchDetails.payload)
                                                     ^^^^^^^
: Error: The getter 'WebView' isn't defined for the class '_PaymentScreenState'.
package:flutter_sixvalley_ecommerce/…/payment/payment_screen.dart:46
- '_PaymentScreenState' is from 'package:flutter_sixvalley_ecommerce/view/screen/payment/payment_screen.dart' ('lib/view/screen/payment/payment_screen.dart').
package:flutter_sixvalley_ecommerce/…/payment/payment_screen.dart:1

.
. (goes on like this for the rest of the packages)
.

    Failed to package /Users/abdelrahmanmohamed/development/FlutterProjects/valley_userapp.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Building targets in dependency order
    warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
    Result bundle written to path:
        /var/folders/4m/6ntf71vx17qfqdg9kr88s2s80000gn/T/flutter_tools.V6z5EC/flutter_ios_build_temp_dirX4Qj6c/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited

No matter how much I do flutter clean and arch -x86_64 pod install. It keeps doing this.

I am using a mac silicon machine. And this is a project I didn't run before on it. So its new.

I am using Flutter 3.3.10. And I am able to build and run other Flutter apps.

CodePudding user response:

So running dat analyze as @Alaindeseine suggested revealed in the code editor that these were actually errors in code. The assets were old and when I updated them it didn't reflect in the code editor.

CodePudding user response:

You can use dart anayze command to display info, warnings, errors and deprecateds. It may help finding what is going wrong with you code.

You can alos use dart fix --dry-runcommand to list and dart fix --apply to fix problems.

  • Related