我的 Mac 上的 Docker 安装可能有点混乱。起初我安装了 Docker 桌面,但运行它后我了解到,由于我使用的是较旧的 Mac,所以我必须安装 VirtualBox,所以我按照以下步骤操作:
/usr/local/bin允许用户在文件夹上写入
sudo chown -R $(whoami) /usr/local/bin
安装 Docker-Machine
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
Run Code Online (Sandbox Code Playgroud)
从开发帐户手动安装 Xcode CLI
安装自制啤酒
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Run Code Online (Sandbox Code Playgroud)
安装 Docker + wget (使用 Brew)
brew install docker
brew install wget
安装 bash 补全脚本
base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
do
sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done
Run Code Online (Sandbox Code Playgroud)
启用 docker-machine shell 提示符
echo 'PS1='[\u@\h \W$(__docker_machine_ps1)]\$ '' >> ~/.bashrc
安装 VirtualBox、ExtensionPack …
我在尝试使用Facebook登录时遇到此错误:
Optional(Error Domain=com.facebook.sdk.core Code=3 "(null)" UserInfo={com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unknown error building URL.})
我在其他帖子中读到这是一个错误,版本是4.39.0版本的FBSDKLoginKit,解决方案正在降级到4.38.o现在这给了我另一个错误:Firebase Auth Interop/FIRAuth Interop.h' file not found in the FIRAuth.m #import <FirebaseAuthInterop/FIRAuthInterop.h>
因为我是新的社交登录和Facebook开发者页面中的指南不是最新的swift和一些是obj-c我可能误解为swift.你能发现问题出在哪里吗?此外,FBSDKLogin框架在frameworks文件夹中以红色突出显示,并且pods/Frameworks文件夹中的所有框架都以突出显示.这是代码:AppDelegate
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge], completionHandler: ({_,_ in
}))
UNUserNotificationCenter.current().delegate = self
var error: NSError?
do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
} catch let error1 as NSError{
error = error1
print("could not set session. err:\(error!.localizedDescription)")
}
do {
try AVAudioSession.sharedInstance().setActive(true)
} catch let error1 as NSError{
error = error1 …Run Code Online (Sandbox Code Playgroud) 我使用该包向我的应用程序添加声音audioplayers,但最初构建时没有播放声音。加载文件时热重启面团后,我收到此异常:
E/flutter (32175): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Unable to load asset: assets/assets/click.mp3
E/flutter (32175): #0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
E/flutter (32175): <asynchronous suspension>
E/flutter (32175): #1 AudioCache._fetchAsset (package:audioplayers/audio_cache.dart:60:29)
E/flutter (32175): #2 AudioCache.fetchToMemory (package:audioplayers/audio_cache.dart:67:30)
E/flutter (32175): <asynchronous suspension>
E/flutter (32175): #3 AudioCache.load (package:audioplayers/audio_cache.dart:82:37)
E/flutter (32175): #4 AudioCache.getAbsoluteUrl (package:audioplayers/audio_cache.dart:140:23)
E/flutter (32175): #5 AudioCache.play (package:audioplayers/audio_cache.dart:103:24)
E/flutter (32175): #6 _MapScreenState.build.<anonymous closure> (package:fixit_cloud_biking/Screens/map_screen.dart:1239:46)
E/flutter (32175): #7 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:706:14)
E/flutter (32175): #8 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:789:36)
E/flutter (32175): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (32175): #10 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:486:11)
E/flutter (32175): …Run Code Online (Sandbox Code Playgroud) 我的 Flutter 应用依赖于 intl_utils: ^1.6.3,今天我将 Flutter 升级到最新的Flutter (Channel master, 1.26.0-2.0.pre.86, on Mac OS X 10.15.4 19E287 darwin-x64, locale en-US).
现在,当我运行 pub get 时,出现此错误:
Because every version of flutter_localizations from sdk depends on intl 0.17.0-nullsafety.2 and intl_translation >=0.17.7 depends on intl >=0.15.3 <0.17.0, flutter_localizations from sdk is incompatible with intl_translation >=0.17.7.
Because intl_utils >=1.6.3 <1.9.0 depends on intl_translation 0.17.10 and intl_utils >=1.9.0 depends on intl_translation 0.17.10+1, intl_utils >=1.6.3 requires intl_translation 0.17.10 or 0.17.10+1.
Thus, flutter_localizations from sdk is incompatible …Run Code Online (Sandbox Code Playgroud) 我从 flutter 开始,因为我想将我的 swift 应用程序移植到 Flutter,但是我在遵循教程https://bloclibrary.dev/#/flutterfirestoretodostutorial 时无法理解模式 Bloc/Repository/Firebase面团我使用实时数据库,而不是 Firestore。我的 swift 应用程序基本上是一张地图,您可以在其中在您的实际坐标处添加警报。警报被发送到 Firebase,地图上的 firebase 观察者会更新地图,显示刚刚添加的警报。上面的教程应该可以帮助我移植我的应用程序。我只是不确定我是否理解代码背后的逻辑。我的担忧是2:
第一的。Entity模型对象和 firebase 对象之间有一层。据解释,这将有助于拥有不同的数据提供者,但我并没有真正看到它促进任何事情。在Model类中有一个toEntity()和一个fromEntity()转换方法,在Entity类中有一个fromSnapshot()和一个toDocument()转换方法。我不明白这里有什么意义。真的有必要吗?直接在Model类中每个数据提供者都有不同的方法?
第二。在里面TodoBloc我不能遵循逻辑。发送到集团的第一个事件AppStart是LoadTodos。
BlocProvider<TodosBloc>(
create: (context) {
return TodosBloc(
todosRepository: FirebaseTodosRepository(),
)..add(LoadTodos());
Run Code Online (Sandbox Code Playgroud)
在mapEventToState()方法TodoBloc该事件被映射到该流:
Stream<TodosState> _mapLoadTodosToState() async* {
_todosSubscription?.cancel();
_todosSubscription = _todosRepository.todos().listen(
(todos) => add(TodosUpdated(todos)),
);
}
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好。据我了解,这订阅了todos()Stream ()
@override
Stream<List<Todo>> todos() {
return todoCollection.snapshots().map((snapshot) …Run Code Online (Sandbox Code Playgroud) 我正在使用 Flutter 构建我的网站,但网络编程对我来说非常陌生,我不太确定我到底理解 Cookie 是如何工作的。我仍然需要了解哪些 cookie 将写入何处,以及我从哪里获取这些 cookie。构建横幅来管理应该很容易,如果我没记错的话,它应该是主页中弹出的第一件事。例如,中横幅只是一个可关闭的横幅,摆动消息
To make Medium work, we log user data. By using Medium, you agree to our Privacy Policy.
带有隐私政策链接的消息,但它没有任何选择加入,因此它看起来不符合 GDPR。
这里https://medium.com/@mayur_solanki/flutter-web-forming-hummingbird-ba52f5135fb0展示了如何在flutter web中写入和读取cookie
html.window.localStorage['key']
html.window.sessionStorage['key']
html.window.document.cookie
html.window.localStorage['local_value'] = localStorage;
html.window.sessionStorage['session_value'] = sessionStorage;
html.window.document.cookie= "username=${cookies}; expires=Thu, 18 Dec 2020 12:00:00 UTC";
Run Code Online (Sandbox Code Playgroud)
据我了解,cookies 就是这些类型。
第一方:为了跟踪用户行为(页面访问、用户数量等),当我使用谷歌分析时,我确实需要征求这些行为的同意。这里展示了Google Analytics、Flutter、cookie 和通用数据保护条例 (GDPR)如何激活/停用它,所以如果我没有错的话,我不应该自己存储任何内容。
第三方:例如,这些内容可能来自我主页上的 YouTube 链接视频,因此我也需要征求这些内容的同意。还没有检查过,但我想它应该类似于 Google Analytics
会话cookie:这些应该用于记住购物篮中的物品。我不应该需要这些..
持久cookie:这些应该用于保持用户登录。其中一个网页是Retailer access,它是零售商的应用程序(市场的供应方)。我正在使用 Google 签名来登录用户,所以我应该需要这些,因为Retailer access即使在用户登录后导航时,它也始终会向用户呈现登录表单。
安全 cookie:这些 cookie 仅适用于 https,用于结帐/付款页面。在我的网络中,零售商的应用程序仅创建产品、管理研讨会预订以及处理与客户的沟通。移动应用程序(市场的需求方)是使用 Stripe 进行所有付款的地方,因此我不必存储网上有什么东西..对吧?
抱歉问了这么长的问题,我希望它足够清楚。感谢您的帮助。
我的应用程序可以正确从 Android 和 iOS 获取设备区域设置,但不能从网络获取设备区域设置。ui.window.locale.languageCode我使用包获取网络区域设置语言代码ui.dart。在我的 Mac 中,我将系统语言设置为意大利语,时区设置为意大利,位置服务设置为启用,但当我在 Chrome 上运行我的应用程序时,它总是返回“en_”。我有什么事情要做吗?这是 main() 中的代码:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Locale myLocale = Localizations.localeOf(context);
return MaterialApp(
title: '',
color: Colors.red,
localizationsDelegates: [
const AppLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('en', 'US'),
const Locale('it', 'IT')
// const Locale('es', 'ES'),
],
localeResolutionCallback:
(Locale locale, Iterable<Locale> supportedLocales) {
for (Locale supportedLocale in supportedLocales) {
if (kIsWeb) {
Locale webLocale = Locale(ui.window.locale.languageCode, '');
print('system locale is …Run Code Online (Sandbox Code Playgroud) 我试图避免图像加载延迟,导致它在我的无状态 SplashScreen 中弹出,但没有运气。我尝试加载图像main()并将其传递给构造函数,但没有任何更改。
我读了很多关于同一问题的答案,并且所有帖子都precacheImage在Stateful Widget 的扩展 State 类中使用,所以我尝试了它,但即使遵循答案示例和本文https://alex,didChangeDependencies结果仍然相同。 domenici.net/archive/preload-images-in-a-stateful-widget-on-flutter。
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
Image logo;
@override
void initState() {
super.initState();
logo = Image.asset(
'assets/notification.png',
height: 170,
width: 170,
);
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
precacheImage(logo.image, context);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.redAccent,
body: Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ …Run Code Online (Sandbox Code Playgroud) 我有一个与其连接的文本字段TextEditingController()。在onChanged:回调中,我执行文本检查以仅允许时间输入。当在 iOS 上运行CupertinoTextfield并且其行为符合预期时,每次输入光标都会移动,因此下一个数字位于正确的位置,因此输入 1000 将得到 10:00。当在网络或 Android 上运行Material Textfield时,问题是当光标停留在第一个位置时文本向后显示,因此输入 1000 将导致 00:01 ..我尝试启用autofocus: true,但没有帮助。我尝试过textDirection: TextDirection.ltr,但也没有修复。我还尝试了另一篇文章中的解决方案,抓取控制器选择并将其重新应用到选中的文本上,但它也没有帮助。我缺少为 Material Textfield 设置什么?一如既往,非常感谢您的时间和帮助。
这是小部件:
Expanded(
flex: 2,
child: kIsWeb
? TextField(
keyboardType: TextInputType.numberWithOptions(),
textDirection: TextDirection.ltr,
autofocus: true,
controller: monMorOp,
onChanged: (value) {
TextSelection previousSelection =
monMorOp.selection;
monMorOp.text = validateTimeFormat(value);
monMorOp.selection = previousSelection;
},
)
: Platform.isIOS
? CupertinoTextField(
keyboardType:
TextInputType.numberWithOptions(),
controller: monMorOp,
onChanged: (value) {
monMorOp.text = validateTimeFormat(value);
},
)
: TextField(
keyboardType: …Run Code Online (Sandbox Code Playgroud) 这是我第一次完成归档我的应用程序的过程,我的问题是,当我构建项目时,它构建得很好,它在模拟器上比物理 iPad 上都运行得很好,但是当我选择Archive它时,它会失败并显示错误消息Command PhaseScriptExecution failed with a nonzero exit code 31merror: Unable to read GoogleService-Info.plist at path。在 SO 上的其他帖子之后,我确保存在 in Build Phases/Copy Bundle Resources GoogleService-Info.plist。我还检查了GoogleService-Info.plist是否正确选择了Target Membership。我试图删除,将其扔进垃圾箱,然后通过拖放将其重新添加到项目中。我重新启动了 Xcode,但没有解决它。关于我还应该看什么的任何想法?它可能与我的开发人员证书有关吗?一如既往,非常感谢。
更新:
我尝试卸载 Pod 并重新安装它们,但没有任何更改。我再次GoogleService-Info.plist从 Firebase下载了,但这也没有什么区别。
更新 2:
我删除了 firebase 应用程序并重新创建了一个。重新下载了GoogleService-Info.plist它,它在 iPad 和模拟器上都可以正常工作。
但仍然存档失败无法读取GoogleService-Info.plist..
我实际上是在为 iOS 9.3 及更高版本进行部署……这与它有关系吗?