Hi everyone,
We came an issue that, In some scenarios in our app we cannot fetch any resources from device (Photo and Contact).
One case we catched is putting app in background and spending time in other commonly used apps and coming back to our app cause this issue but there is a small chance that get this issue during using the application.
In cell, we are trying to fetch the image like this
imageFetchTask = Task {
let image = await CompositionRoot.shared.photosManager.image(requestType: .imageCollections, forId: photoAsset.photoId)
self.photoImageView.image(image)
}
and inner layers of this code we get the PHAsset and request image
PHAsset.firstAsset(for: id)
let manager = PHImageManager.default()
manager.requestImage(for: asset, targetSize: request.targetSize, contentMode: .aspectFill, options: request.options) { (image, info) in
continuation.resume(returning: image)
}
We figured out that issue not happening only in Photos also Contacts and
any web request. So any help according to this situation is well appreciated.
Thanks
Background Assets
RSS for tagSchedule background downloads of large assets during app installation, when the app updates, and periodically while the app remains on-device.
Posts under Background Assets tag
16 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
DeviceActivityReport presents statistics for a device: https://developer.apple.com/documentation/deviceactivity/deviceactivityreport
The problem: DeviceActivityReport can present statistics with a delay for a parent device (when DeviceActivityReport is presenting, the DeviceActivityReportExtension is called to process the statistics). One possible solution is to call DeviceActivityReport periodically throughout the day in a child device. However, the app will not be available all day. Is there any way to run DeviceActivityReport in the background?
I have tried the following approach, but it didn’t work (DeviceActivityReportExtension didnt call):
let hostingController: UIHostingController? = .init(rootView: DeviceActivityReport(context, filter: filter))
hostingController?.view.frame = .init(origin: .zero, size: .init(width: 100, height: 100))
hostingController?.beginAppearanceTransition(true, animated: false)
hostingController?.loadView()
hostingController?.viewDidLoad()
try? await Task.sleep(for: .seconds(0.5))
hostingController?.viewWillAppear(true)
hostingController?.viewWillLayoutSubviews()
try? await Task.sleep(for: .seconds(0.5))
hostingController?.viewDidAppear(true)
try? await Task.sleep(for: .seconds(0.5))
hostingController?.didMove(toParent: rootVC)
try? await Task.sleep(for: .seconds(0.5))
hostingController?.viewWillLayoutSubviews()
hostingController?.viewDidLayoutSubviews()
hostingController?.view.layoutIfNeeded()
hostingController?.view.layoutSubviews()
hostingController?.endAppearanceTransition()
Is there any way to run DeviceActivityReport in the background? (when app is not visible/closed). The main problem is call DeviceActivityReport
The background asset keys (BAEssentiaMaxInstallSize/BAMaxInstallSize) referenced in the app's Info.plist will be displayed to users on the App Store, as outlined in the WWDC video and supported by Apple’s documentation.
Could you please clarify where exactly on the App Store's product page these values will be visible?
Is the size displayed on the App Store a sum of the app bundle size and the size specified in these keys within the Info.plist?
Hi,
I'm implementing a BADownloaderExtension in my app for essential assets. I would like to treat the install case differently than the update case, however it seems whether I "install" or "update" the app (via TestFlight) I always end up getting a BAContentRequest of type .install. I can simulate an update via xcrun, but cannot seem to get into that case in the wild. Is this expected?
My app is able to receive data updates when it is in foreground.
however, when i move it in background then sync engine stops syncing until I again move app to foreground.
Hi Ty for playing
I want to download some large files on watchOS and I found Apple Music app is able to download songs in background and pause downloading depending on battery life. Does there any way to do the same thing in my own app? After users choose to download, keep the downloading task in background and pause/resume on demand.
I am having an issue with scheduling daily background task (eg: nightly) when app is in terminated app state (user forcefully terminated the app from app switcher).
If the app is in suspended state, I am able to schedule a daily background task. But is there a way to wake up the app nightly and register a BGTask when user forcefully terminates the app.
The app declares support for Voice-over IP (VoIP) in the UIBackgroundModes key in your Info.plist, but we are still unable to locate any VoIP services. Apps that declare support for VoIP in the UIBackgroundModes key in your Info.plist file must have features that require VoIP.
My app rejected for VOIP and the app is totally supported video call or call when app is terminated or in background how can. i solve that rejection issue
At WWDC 2023, the background asset feature was introduced, allowing essential resources to be downloaded before the game is first launched. How does this differ from including all necessary resources directly in the installation package? What are the advantages of this approach, and how does it enhance the user experience?
Dear Apple Developer Support,
I have a question regarding the Background Assets feature for a game we are planning to release on the App Store. Specifically, I would like to understand the user experience during the initial installation process.
If our game utilizes the Background Assets feature and we have essential assets specified in the BAExtension, will the end user need to wait for these essential assets to be fully downloaded before they can open the game after installing it from the App Store? Additionally, during this download process, will there be any indication of the essential assets' download status on the App Store or on the home screen icon of the game?
Your guidance on how this process is managed and what the user can expect would be greatly appreciated.
Thank you for your assistance.
Hello, I have applied background assets on my app. It does allow you to download resources in advance, increasing the speed of resource presentation. But I found that the download success rate was only 20% (Within an app with tens of millions of users). And most of the error codes are:
BAErrorDomain Code=111 "The requested download could not be enqueued. Check the device‘s Low Power Mode or Background App Refresh settings" .
Generally speaking, the proportion of low power mode should be around 20%. So why are there so many 111 error codes
In XCode organizer, under reports section, Crashes info shows fine with call stacks but Disk writes, Energy and Hang reports sections are broken since Background Assets frameworks integration.
Error msg:
The operation couldn't be completed. ((extension in DVTProducts):DVTAppStoreConnect.AppExtension.(unknown context at $10beb2a18).AppExtensionError error 0.)
Xcode failed loading app information.
How to fix this error and get the reports under Disk writes, Energy and Hang reports section?
Hardware: iPhone 12/iOS 15.1.1
I am having problems getting urlSession(_:task:didCompleteWithError:) to fire when session configured for background.
I set up my background session and uploadTask as such:
let config = URLSessionConfiguration.background(withIdentifier: "my.unique.session.identifier")
config.isDiscretionary = false
config.sessionSendsLaunchEvents = true
config.allowsCellularAccess = true
config.httpMaximumConnectionsPerHost = 1
config.timeoutIntervalForRequest = 30
config.timeoutIntervalForResource = 60
let session = URLSession(configuration: config, delegate: yourDelegate, delegateQueue: nil)
let task = session.uploadTask(with: request, from: data)
task.resume()
First, I confirmed that I can upload using the above code.
Then to simulate a timeout, I set a breakpoint in Charles Proxy on the response. When triggered, I just wait. urlSession(_:task:didCompleteWithError:) is never called, no matter how long I wait. I can "see" the background session periodically retrying the upload, because I having logging in urlSession(_:task:didSendBodyData:). Every time didSendBodyData is called, it triggers the breapoint in Charles Proxy. And I wait. didCompleteWithError never gets called.
One more observation: if I change the session config from 'background' to 'default', didCompleteWithError is triggered.
Thanks!
I have the following problem when using background asset:
"The requested URL is not permitted to be downloaded until the application is launched."
My code is as follows:
NSDictionary *infoDict = [NSBundle mainBundle].infoDictionary;
self.downloadAsset = [[BAURLDownload alloc] initWithIdentifier:@"BAManifestURL" request:[NSURLRequest requestWithURL:[NSURL URLWithString:infoDict[@"BAManifestURL"]]] essential:NO fileSize:1610612736 applicationGroupIdentifier:@"group.com.iphone.share" priority:BADownloaderPriorityDefault];
The configuration file is as follows:
Please tell me how to solve this problem.
Hi,
In XCode organizer, under reports section, Crashes info shows fine with call stacks but Disk writes, Energy and Hang reports sections are broken recently. When I try to access any of these sections it says "The operation couldn't be completed. ((extension in DVT Products):....[Attached error screenshot]"
How to fix this error and get the reports under Disk writes, Energy and Hang reports section?
Regards,
Eshwar