一、FlutterIOs打包
1、FlutterIOs是一款跨平台開發框架,支持一次編寫,多平台運行
2、在FlutterIOs開發完成後,需要對應用進行打包
3、執行以下命令進行打包:
flutter build ios --release --no-codesign
該命令會在FlutterIos項目的build/ios下生成Runner.xcarchive文件,即為我們需要的打包文件。
二、FlutterIOs應用上架
1、在成功打包之後,我們需要將應用上傳到App Store進行上架
2、首先需要在App Store Connect中創建應用信息
3、通過Xcode將Runner.xcarchive文件上傳到App Store Connect中的應用信息中,進行審核和上架
三、FlutterIOs開發
1、FlutterIOs擁有豐富的UI組件庫,開發者可以通過調用這些組件來實現應用的不同布局
2、FlutterIOs支持響應式編程,可以根據不同設備的大小自適應界面
3、FlutterIOs的開發語言為Dart,可以使用熟悉的OOP思維進行編程
4、示例代碼:
import 'package:flutter/material.dart'; class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { int _counter = 0; void _incrementCounter() { setState(() { _counter++; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( 'You have pushed the button this many times:', ), Text( '$_counter', style: Theme.of(context).textTheme.headline4, ), ], ), ), floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: Icon(Icons.add), ), ); } }
四、FlutterIOs音量不能調節媒體選取
1、FlutterIOs在調用媒體選取的時候,無法調節音量大小
2、需要將FlutterIOs項目中iOS目錄的Info.plist文件,增加如下字段:
UIUserInterfaceStyle Light NSMicrophoneUsageDescription Allow access to microphone to record audio NSPhotoLibraryUsageDescription Allow access to photo library to select images and videos NSCameraUsageDescription Allow access to camera to take photos and videos NSAppleMusicUsageDescription Allow access to Apple Music to select songs for image/video NSMotionUsageDescription Allow access to motion and fitness to calculate health information NSBluetoothAlwaysUsageDescription Allow access to bluetooth NSBluetoothPeripheralUsageDescription Allow access to bluetooth UIBackgroundModes fetch remote-notification audio voip processing bluetooth-central bluetooth-peripheral background-fetch location io.flutter.embedded_views_preview
3、示例代碼如下:
CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleVersion 1 DTPlatformName iphoneos DTSDKName iphoneos14.5 FlutterBuildNumber 1.0.0 FlutterPod Flutter LSRequiresIPhoneOS UIRequiredDeviceCapabilities armv7 arm64 gamekit UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIViewControllerBasedStatusBarAppearance UIUserInterfaceStyle Light NSMicrophoneUsageDescription Allow access to microphone to record audio NSPhotoLibraryUsageDescription Allow access to photo library to select images and videos NSCameraUsageDescription Allow access to camera to take photos and videos NSAppleMusicUsageDescription Allow access to Apple Music to select songs for image/video NSMotionUsageDescription Allow access to motion and fitness to calculate health information NSBluetoothAlwaysUsageDescription Allow access to bluetooth NSBluetoothPeripheralUsageDescription Allow access to bluetooth UIBackgroundModes fetch remote-notification audio voip processing bluetooth-central bluetooth-peripheral background-fetch location io.flutter.embedded_views_preview
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/186638.html