草庐IT

AT_appDelegate

全部标签

iphone - 在 AppDelegate.m 中获取当前显示在屏幕上的 UIViewController

屏幕上的当前UIViewController需要通过设置一些角标(Badge)View来响应来自APNs的推送通知。但是我怎样才能在AppDelegate.m的方法application:didReceiveRemoteNotification:中获取UIViewController?我尝试使用self.window.rootViewController获取当前显示的UIViewController,它可能是UINavigationViewController或其他类型的ViewController。我发现UINavigationViewController的visibleViewCo

flutter : SharedPreferences not fetching value at app start

我正在尝试存储一个值,并根据该值导航到LandinPage或HomePage。但是,当我的应用程序加载时,我无法获得SharedPreferences值。目前,该值是在单击着陆页中的按钮以及关闭/最小化应用程序时设置的。我什至看不到来自main.dart的打印消息,也无法获取值。我究竟做错了什么?这是我的代码:import'package:credit/src/pages/landing.dart';import'package:flutter/material.dart';import'package:credit/src/pages/credit/home.dart';import

flutter - if condition to run Widget at Container flutter

if条件whenpost.text==1我设置了名为exteranews的小部件Widgetexteranews(BuildContextcontext){doublesiz11=15.0*MediaQuery.of(context).size.width/414.0;}如何在容器中使用ifContainer(if(checkothers)child:exteranews(context),),我设置Stringcheckothers=post.text;我读到我必须设置Widget才能使用runexteranews()但是如何使用if条件 最佳答案

firebase - flutter/FirebaseAuth : How can I autologin a user at app launch?

我有以下方法来查看用户是否已经登录,在这种情况下我确实登录了并且getCurrentUser()函数起作用,因为在控制台中它确实返回“USERISNOTNULL”,但home小部件仍然为null,给我“WIDGETSLIBRARY捕获的异常”,表示home不能为null之类的东西。用户API.dartFuturegetCurrentUser()async{FirebaseUseruser=awaitFirebaseAuth.instance.currentUser();if(user!=null){returnuser;}else{returnnull;}}主.dartclassApp

docker - 删除所有停止的容器 : "docker rm" requires at least 1 argument

我正在读一本关于docker的书。几年了。我会引用:Ifyouwanttogetridofallyourstoppedcontainers,youcanusetheoutputofdockerps-aq-fstatus=exited,whichgetstheIDsofallstoppedcontainers.Forexample:$dockerrm-v$(dockerps-aq-fstatus=exited)当我运行它时,我得到:michael@michael-desktop:~$sudodockerrm-v$(dockerps-aq-fstatus=exited)Gotpermiss

docker - 删除所有停止的容器 : "docker rm" requires at least 1 argument

我正在读一本关于docker的书。几年了。我会引用:Ifyouwanttogetridofallyourstoppedcontainers,youcanusetheoutputofdockerps-aq-fstatus=exited,whichgetstheIDsofallstoppedcontainers.Forexample:$dockerrm-v$(dockerps-aq-fstatus=exited)当我运行它时,我得到:michael@michael-desktop:~$sudodockerrm-v$(dockerps-aq-fstatus=exited)Gotpermiss

Redis messagebus vs. d-bus : what is happening at a low level? 基本上是一样的东西?

老实说,我很惊讶以前没有看到有人讨论过这个问题。我的印象是Redis使用普通的互联网数据包交换到服务器并取回结果,但d-bus使用unix套接字(管道)并叠加一个分布式系统。我想我有一个常见的问题,即哪个更快,但我真的很想知道当我用这两个中的任何一个传递消息时到底发生了什么。两者可能都有优势。有人可以透露一点吗? 最佳答案 这就像讨论MQTT与COM或SOAP与QNX-IPC。D-Bus也有一个基于TCP的网络模式。所以在低层次上它可能是同一件事。但是在本地使用D-Bus时,不涉及网络栈。Redis从普通套接字和弱结构数据库、D-B

python - Tornado -redis : Why the 'listen' and the 'brpop' of tornado-redis can't work at the same time

代码如下:fromtornadoredisimportClientfromtornado.ioloopimportIOLoopfromtornado.genimportcoroutine,Taskrds=Client()@coroutinedeflisten_pub():defhandle(msg):printmsgyieldTask(rds.subscribe,channels='pub')rds.listen(handle)@coroutinedeflisten_list():whileTrue:res=yieldTask(rds.brpop,keys='list')printre

ios - 如何重构我的代码以在主线程上调用 AppDelegate?

我最近开始将我的项目从Swift3/Xcode8迁移到Swift4/Xcode9。我的应用程序在运行时崩溃,因为主线程清理器只允许在主线程上访问UIApplication.shared.delegate,导致启动时崩溃。我有以下代码,它在Swift3中运行良好-staticvarappDelegate:AppDelegate{returnUIApplication.shared.delegateas!AppDelegate;}我代码中的其他类可以访问appDelegate。我需要找出一种从主线程返回UIApplication.shared.delegate的方法。注意:从访问appDe

ios - 无法在 Swift AppDelegate 文件中访问 Google Map Framework

我正在研究Swift,并且正在努力弄清楚如何集成GoogleMapSDK框架。我在Xcode6中创建了一个新项目,按照适用于iOS的GoogleMapSDK说明导入了所需的框架。但是,当我使用(import)将GoogleMaps框架导入AppDelegate.swift文件时,无法识别该框架。到处都找不到解决方案。请帮忙。 最佳答案 导入GoogleMapsiOSSDK后,您需要定义桥接header,SDK才能被识别。要创建此桥接header,请将任意Objective-C文件(例如:.m文件)添加到您的项目中。Xcode会提示你