对于标签栏控制器的第二项,我有一个想要以模态方式呈现的导航控制器。我不断收到一条错误消息
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“应用程序试图以模态方式呈现活动控制器。”
然后我的应用程序崩溃并转到应用程序委托。
这是我到目前为止的代码
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if let restoreID = viewController.restorationIdentifier {
if restoreID == "NavigationCamera" {
if let nav = tabBarController.viewControllers![tabBarController.selectedIndex] as? UINavigationController {
print("Nav is allowed")
//let newVC = tabBarController.storyboard?.instantiateViewController(withIdentifier: "CameraView")
tabBarController.present(nav, animated: true, completion: {
print("complete")
})
return false
}
}
}
return true
}
Run Code Online (Sandbox Code Playgroud)
在我的应用程序上工作了一天之后,我意识到它占用的存储空间是 1.17 GB。实际应用大小为 57.5 MB,而文档和数据占用 1.11 GB。如何检查我的应用程序文档和数据中的内容?
更新:我通过转到窗口 -> 设备和模拟器 -> 单击应用程序 -> 下载容器来下载容器。
然后我进入容器内容,我看到所有这些“堆栈日志”,每个都有 11-23 MB,有一堆。任何人都知道“堆栈日志”是什么?
注意:我的应用使用 Firebase 数据库和存储作为后端
在我的应用程序中,当用户向下滑动视图时,我希望视图关闭到某个帧。这是我迄今为止尝试过的,但由于某种原因,它一直给我这个错误:
“#selector”的参数不引用“@objc”方法、属性或初始值设定项
这是我的代码如下:
class VideoLauncher: NSObject {
@objc func dismissView(myView: UIView) {
UIView.animate(withDuration: 0.4) {
if let theWindow = UIApplication.shared.keyWindow {
myView.frame = CGRect(x:theWindow.frame.width - 15 , y: theWindow.frame.height - 15, width: 10 , height: 10)
}
}
}
func showVideoPlayer() {
print("showing player")
if let keyWindow = UIApplication.shared.keyWindow {
let view = UIView(frame: keyWindow.frame)
view.backgroundColor = UIColor.spaceBlue
view.frame = CGRect(x: keyWindow.frame.width - 10, y: keyWindow.frame.height - 10, width: 10, height: 10)
let videoPlayerView = VideoPlayerView(frame: keyWindow.frame)
keyWindow.addSubview(view)
view.addSubview(videoPlayerView)
let …Run Code Online (Sandbox Code Playgroud)