我已经添加了一些登录功能,该功能可以使用可用的内容通知向我们的应用下载相当大的内容包,并且我注意到有些行为有些奇怪,并且不确定如何正确处理:] >
application:didReceiveRemoteNotification:fetchCompletionHandler
方法。方案2是这里的预期行为吗?我在网上看不到任何地方(苹果论坛,文档,官方网站)说这可能发生,但显然是这样!
如果发生2.,我的计划是检测该通知是否为无内容可用的通知,并像下面这样运行相同的后台下载逻辑(伪代码):
var launchedByContentPush: Bool = false if let remoteNotification = launchOptions?[.remoteNotification] as? [AnyHashable : Any], let aps = remoteNotification["aps"] as? [AnyHashable : Any] { launchedByContentPush = aps.keys.count == 1 && aps["content-available"] as? Int == 1 } if launchedByContentPush { // 1. Don't do normal app-setup stuff which shouldn't be done // 2. Download content }
这是一个明智的计划,还是在用户实际启动该应用程序的某些情况下,我最终可能会破坏1.以下的内容?
仅100%确认:我正在接收内容可用的通知,一切都在该方面进行,因此,就我所知,这不是配置问题!
显示的是一些日志,其中一个会话运行正常,另一个用于调用applicationDidFinishLaunching
的会话
INCORRECT
2020-04-02T19:01:03Z [INFO] | com.threesidedcube.ThunderCloud (ContentController) | Initialising Content Controller 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Setting app build date to 2 April 2020 at 19:42:56 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | <REDACTED> 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages Error: The folder “languages” doesn’t exist. 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages Error: The folder “languages” doesn’t exist. 2020-04-02T19:01:03Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | application:DidFinishLaunchingWithOptions with keys: [__C.UIApplicationLaunchOptionsKey(_rawValue: UIApplicationLaunchOptionsRemoteNotificationKey)] 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages Error: The folder “languages” doesn’t exist. 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages Error: The folder “languages” doesn’t exist. 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages Error: The folder “languages” doesn’t exist. 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | `appLaunched` called 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking for app upgrade 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Optionally checking for updated content 2020-04-02T19:01:03Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking for updates with timestamp: 1585848393.0 2020-04-02T19:05:48Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationWillEnterForeground 2020-04-02T19:05:48Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking for updates failed: The request timed out. 2020-04-02T19:05:49Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationDidBecomeActive 2020-04-02T19:08:33Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationWillResignActive 2020-04-02T19:08:34Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationDidEnterBackground
CORRECT
2020-04-02T23:19:12Z [INFO] | com.threesidedcube.ThunderCloud (ContentController) | Initialising Content Controller
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Setting app build date to 2 April 2020 at 19:42:56
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Base URL configured as: <REDACTED>
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:19:12Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | application:DidFinishLaunchingWithOptions with keys: []
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | `appLaunched` called
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking for app upgrade
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Optionally checking for updated content
2020-04-02T23:19:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking for updates with timestamp: 1585848393.0
2020-04-02T23:19:12Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationDidBecomeActive
2020-04-02T23:19:13Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No update found
2020-04-02T23:20:36Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationWillResignActive
2020-04-02T23:20:37Z [INFO] | com.threesidedcube.ThunderCloud (AppState) | applicationDidEnterBackground
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Push notification received, checking if it's a `content-available` push
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | content-available == 1 sending notification off to `ContentController`
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | `appLaunched` called
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking for app upgrade
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Handling content-available notification
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Making sure notification bundle isn't after a landmark publish this app shouldn't receive
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No landmark timestamp provided in notification
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Checking notification timestamp against latest on-disk bundle version
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Downloading content-available bundle with timestamp: 1685827838.0
2020-04-02T23:35:57Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Downloading bundle: <REDACTED>
Destination: file:///var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application%20Support/StormDeltaBundle/
2020-04-02T23:36:04Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Handling events for background url session: 784B47D4-C2B6-4310-ADD5-8539BE40A447-60638-000035ACB72C6167
2020-04-02T23:36:04Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Starting background request controller
2020-04-02T23:36:06Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Unpacking bundle...
2020-04-02T23:36:06Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | data.tar.gz read to data object
2020-04-02T23:36:06Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Attempting to gunzip data from data.tar.gz
2020-04-02T23:36:07Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Gunzip successful
2020-04-02T23:36:09Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Bundle tar saved to disk
2020-04-02T23:36:09Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Attempting to untar the bundle
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Untar successful
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Verifying bundle...
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Loading manifest.json into JSON object
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Loading manifest.json as dictionary
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | app.json exists
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | manifest.json exists
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Verifying pages
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Verifying languages
2020-04-02T23:36:12Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Verifying content
2020-04-02T23:36:13Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Bundle is valid
2020-04-02T23:36:13Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Cleaning up `data.tar.gz` and `data.tar` files
2020-04-02T23:36:13Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Copying bundle
From: file:///private/var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/tmp/StormDeltaBundle/
To: file:///var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application%20Support/StormDeltaBundle/
2020-04-02T23:36:26Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Beginning excluding from backup files in directory: /var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application Support/StormDeltaBundle/content
2020-04-02T23:36:29Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Beginning excluding from backup files in directory: /var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application Support/StormDeltaBundle/languages
2020-04-02T23:36:29Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Beginning excluding from backup files in directory: /var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application Support/StormDeltaBundle/data
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Beginning excluding from backup files in directory: /var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application Support/StormDeltaBundle/pages
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Beginning excluding from backup files in directory: /var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/Library/Application Support/StormDeltaBundle
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Removing bundle in directory: file:///private/var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/tmp/StormDeltaBundle/
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Update complete, Refreshing language
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: languages
Error: The folder “languages” doesn’t exist.
2020-04-02T23:36:31Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | Removing bundle in directory: file:///private/var/mobile/Containers/Data/Application/CBCB1B36-D853-4E36-B766-9F3F31158DF7/tmp/StormDeltaBundle/
2020-04-02T23:36:33Z [DEBUG] | com.threesidedcube.ThunderCloud (ContentController) | No files exist in streamed bundle directory subfolder: pages
Error: The folder “pages” doesn’t exist.
我已经添加了一些登录功能,可以使用可用的内容通知将大量内容包下载到我们的应用程序中,并且我注意到某些行为有些奇怪,并且不是...
content-available
通知之前由于某种原因终止了应用程序,则会调用didFinishLaunching方法。