在Flutter(iOS)中,我该如何解决这个问题?

3

我正在使用 MacBook Air M2, 我现在参加 APP Jam,还剩下20个小时。我无法解决这个问题。

这就是问题:

                                 ^^^^^^^^^^^^^^
    Failed to package /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Building targets in dependency order
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'AppAuth' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'PromisesObjC' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleUtilities' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'FirebaseCoreInternal' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'FirebaseCore' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GTMSessionFetcher' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GTMAppAuth' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleSignIn-GoogleSignIn' from project 'Pods')
    /Users/renanuya/Desktop/flutter_projects/jam_swifttask_app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleSignIn' from project 'Pods')
    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')
    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')
    Result bundle written to path:
        /var/folders/2p/9n80m79j2rdd3pmx00z38nch0000gn/T/flutter_tools.LM9sht/flutter_ios_build_temp_diryrIlk6/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro.
Exited

这是第三页的代码:

import 'package:flutter/material.dart';
import 'package:jam_swifttask/getStartedPages/thirdpage.dart';
import 'secondpage.dart';
import 'package:jam_swifttask/loginPages/loginpage.dart';
import 'package:jam_swifttask/loginPages/auth_page.dart';

class ThirdPage extends StatelessWidget {
  const ThirdPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    double _height = MediaQuery.of(context).size.height;
    double _width = MediaQuery.of(context).size.width;
    return Scaffold(
      backgroundColor: Colors.grey[300],
      body: Stack(
        children: [
          // Arka plan görüntüsü veya widget'ı burada ekleyebilirsiniz
          Positioned(
            top: 50,
            right: 20,
            child: TextButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(builder: (context) => const AuthPage()),
                );
              },
              child: const Text(
                'Geç',
                style: TextStyle(
                  fontSize: 16,
                  color: Color(0xFF2F2F2F),
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(30.0),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  SizedBox(
                    height: _height * 0.4,
                    width: _width * 0.8,
                    child: Image.asset('assets/bro3.png'),
                  ),
                  SizedBox(height: _height * 0.01),
                  Container(
                    alignment: Alignment.center,
                    child: const Text(
                      'Her Zaman Hatırla',
                      style: TextStyle(
                        fontSize: 24,
                        fontWeight: FontWeight.bold,
                        color: Color(0xFF2F2F2F),
                      ),
                      textAlign: TextAlign.center,
                    ),
                  ),
                  SizedBox(
                    height: _height * 0.035,
                  ),
                  SizedBox(
                    width: _width * 0.7,
                    child: Text(
                      'Swift Task sayesinde görevlerinizi teslim tarihi gelemeden önce hatırlayabilirsiniz.',
                      style: TextStyle(
                        fontSize: 16,
                        color: Color(0xFF2F2F2F),
                      ),
                    ),
                  ),
                  SizedBox(
                    height: _height * 0.24,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        SizedBox(
                          width: _width * 0.8,
                          height: _height * 0.06,
                          child: ElevatedButton(
                            onPressed: () {
                              Navigator.push(
                                context,
                                MaterialPageRoute(
                                    builder: (context) =>
                                        AuthPage()), //normlade AuthPage()'e atmalı ama çalışmıyor
                              );
                            },
                            child: const Text(
                              'Sonraki',
                              style: TextStyle(
                                fontSize: 20,
                                color: Colors.white,
                              ),
                            ),
                            style: ElevatedButton.styleFrom(
                              backgroundColor: Color.fromRGBO(47, 47, 47, 1.0),
                              shape: RoundedRectangleBorder(
                                // <-- Radius
                                borderRadius: BorderRadius.circular(15.0),
                              ),
                            ),
                          ),
                        ),
                        SizedBox(height: _height * 0.1),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}


当我点击“Geç” TextButton 和 Elevated Button 时,出现了这个问题。
这是 auth 页面的代码:
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:jam_swifttask/dashboard_page.dart';
import 'loginpage.dart';
import 'package:jam_swifttask/dashboard_page.dart';

class AuthPage extends StatelessWidget {
  const AuthPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: StreamBuilder<User?>(
      stream: FirebaseAuth.instance.authStateChanges(),
      builder: (context, snapshot) {
        if (snapshot.hasData) {
          return DashboardPage();
        } else {
          return const LoginPage();
        }
      },
    ));
  }
}

我不知道需要提供哪些信息,请告诉我如果您需要了解和解决问题所需的信息。

好的,我尝试一下,这段代码

@override
Size computeDryLayout(BoxConstraints constraints) {
  final hasBoundedHeight = constraints.hasBoundedHeight;
  final hasBoundedWidth = constraints.hasBoundedWidth;
  if (!hasBoundedHeight || !hasBoundedWidth) {
    // Sınırları olmayan bir durumda, kapsayıcı widget'in sınırlarına uyacak şekilde boyutlandırıyoruz.
    return Size(
      hasBoundedWidth ? constraints.maxWidth : double.infinity,
      hasBoundedHeight ? constraints.maxHeight : double.infinity,
    );
  }

  return constraints.biggest;
}
3个回答

1
如果您将XCode版本降级到14.2,则问题将得到解决。

xcode

或者尝试执行flutter upgrade命令。


0

如果您的代码中仍然存在错误,请更新Flutter。


0

看看这个答案
另外,你有一个关于IPHONEOS_DEPLOYMENT_TARGET的警告,你需要从ios文件夹中的Podfile进行更改
ios/Podfile
取消注释此行
# platform :ios, '11.0'
或者只需添加platform :ios, '11.0'

希望它能帮到你。

注意 :我没有足够的声望来评论


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接