如何在Flutter(iOS)中解决此问题

pbossiut  于 2023-04-13  发布在  Flutter
关注(0)|答案(2)|浏览(150)

我正在使用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ç”文本按钮时,当我点击Elavated按钮时,我得到了这个问题。
这是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;
}
iqjalb3h

iqjalb3h1#

如果你将XCode版本降级到14.2,这个问题就会解决。

或者尝试Flutter升级。

mwngjboj

mwngjboj2#

看看这个answer
你也有关于IPHONEOS_DEPLOYMENT_TARGET的警告,你必须从ios文件夹中的Podfile更改它
ios/Podfile
取消注解此行
# platform :ios, '11.0'
或者只添加platform :ios, '11.0'
我希望它能帮助你。

注:I don't have enough rep to comment

相关问题