I am building an app that uses DeviceActivity framework. Looking at the documentation, I need to subclass (https://developer.apple.com/documentation/deviceactivity/deviceactivitymonitor), I need to "subclass DeviceActivityMonitor and designate the subclass as the principal class of my app extension.
I am wondering how to designate my subclass as the principal class. (I am new to iOS development :) .
Post
Replies
Boosts
Views
Activity
I have a scheduled function uses a private queue context to fetch objects from CoreData and uploads them to a server and deletes the fetched objects if successfully uploaded. The upload function is an async function that uses URLSession.
context.perform {
do {
let fetchRequest = NSFetchRequest<CustomEntity>
fetchRequest = CustomEntity.fetchRequest()
let objects = try context.fetch(fetchRequest)
let data = JSONSerialization.data(withJsonObject: objects, options: [])
//
await uploadToServer(data)
// delete after successful upload:
objects.forEach(context.delete)
try context.save()
} catch let error {
}
}
However, this doesn't seem legal though. xcode gives me an error: 'async' call in a function that does not support concurrency.
Stuck on how to invoke the async function within the context.perform { } block
Hello, I am wondering how to designate my DeviceActivityMonitor extension as the principal class on Xcode 13 beta 5
Documentation: https://developer.apple.com/documentation/deviceactivity/deviceactivitymonitor