谁可以解释或在俄语中可以清楚地阅读有关如何在控制器之间正确切换的信息(没有 UINavigationViewController)
在应用程序中我使用将棋(例如推送和演示模式)
当推送带有其他数据(切换到 ActiveInfoVC)时与内存相同的图片,如果返回则内存不会下降
如果您多次重复所有内容,那么应用程序就会崩溃
如何正确进行转换以及如何在控制器关闭时从内存中杀死控制器(我知道在 andriod 中有一个方法 - Finish()) swift 中有什么相似之处?解雇并不总是有效
这是使用 AppDrlegate 捕获 PushNotification 的代码
并且由于某种原因,它仅在应用程序正在运行或在后台运行时才有效,当它被杀死时 - 什么也没有出现,尽管服务器写了 200 OK

当推送带有其他数据(切换到 ActiveInfoVC)时与内存相同的图片,如果返回则内存不会下降
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
// Print message ID.
if let messageID = userInfo[gcmMessageIDKey] {
print("Message ID: \(messageID)")
}
//по тапу з пуша
// Print full message.
print(userInfo)
print("по тапу с пуша==================", userInfo["type"]!)
if userInfo["type"]! as! String == "add_manager" {
let storyboard = UIStoryboard(name: "SearchSB", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "FindOrderVC") as! FindOrderVC
vc.name = userInfo["manager_name"]! as! String
vc.phone = userInfo["manager_phone"]! as! String
vc.photo = userInfo["manager_photo"]! as! String
window?.rootViewController = vc
completionHandler()
} else if userInfo["type"]! as! String == "new_shipment_request" {
let storyboard = UIStoryboard(name: "SearchSB", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "ActiveInfoVC") as! ActiveInfoVC
vc.orderId = userInfo["id"]! as! String
vc.contentType = userInfo["type"]! as! String
window?.rootViewController = vc
completionHandler()
}
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
print(userInfo)
print("1 РАЗ==================", userInfo["type"]!)
switch application.applicationState {
case .inactive:
print("Inactive")
// NEVER CALL HERE
//Show the view with the content of the push
completionHandler(UIBackgroundFetchResult.newData)
return
case .background:
print("Background")
//Refresh the local model
completionHandler(UIBackgroundFetchResult.newData)
return
case .active:
print("Active")
//Show an in-app banner
completionHandler(UIBackgroundFetchResult.newData)
return
}
}


