一、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/n/186638.html
微信扫一扫
支付宝扫一扫