Posts

Post not yet marked as solved
0 Replies
1.1k Views
I'm building an app with background fetch following the instructions provided in the BGTaskScheduler documentation, but unfortunately it's not working, and I can't find a way to debug it. The problem is that the launch handler that I'm registering never gets triggered even if I try simulating a background fetch from the debug menu or creating a scheme to launch the app for background fetch. I'm sure that the request method from BGTaskScheduler is returning true because I'm calling it inside an assert and running for debugging, I have also checked whether background app refresh is disabled either for the app or the whole device and it's not. I have even created a small app to use as a minimum working example and it has the same problem so I don't know what to do next. Here's the code from AppDelegate:     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         // Override point for customization after application launch.         let taskIdentifiers = Bundle.main.object(forInfoDictionaryKey: "BGTaskSchedulerPermittedIdentifiers")! as! [String]         assert(BGTaskScheduler.shared.register(forTaskWithIdentifier: taskIdentifiers[0], using: nil, launchHandler: {[unowned self] in self.backgroundFetch(task: $0 as! BGAppRefreshTask)}))         scheduleBackgroundFetch(identifier: taskIdentifiers[0])         return true     }     private func backgroundFetch(task: BGAppRefreshTask) {         print(#function)         scheduleBackgroundFetch(identifier: task.identifier)     task.expirationHandler = {Client.shared.cancelRefresh()}         let operation = BackgroundFetchOperation()         operation.completionBlock = {task.setTaskCompleted(success: !operation.isCancelled)}         task.expirationHandler = {operation.cancel()}         OperationQueue.main.addOperation(operation)     }     private func scheduleBackgroundFetch(identifier: String) {         let request = BGAppRefreshTaskRequest(identifier: identifier)         request.earliestBeginDate = Date(timeIntervalSinceNow: 60.0)         try! BGTaskScheduler.shared.submit(request)     } I'm using Xcode 11.5 on MacOS 10.15.5 and am testing on a real device with iOS 13.5.1. Can anyone figure out what I'm doing wrong here, or perhaps suggest other things that I should look into and might not be considering? Thanks in advance!
Posted
by Vaelian.
Last updated
.
Post not yet marked as solved
1 Replies
848 Views
GI reported what I thought was a bug in GKOctree to Apple and they closed my report stating that it was investigated and found to be working as documented, which leads me to believe that there is something wrong with my code. The problem is that I'm inserting some points in the tree and when I query for the exact location of those points it returns lots of points that were not originally inserted at those locations.Here is the test code that I wrote and ran on iOS 12.4 and 13.3 with similar results:@import GameplayKit;@import SceneKit;int main(int argc, char * argv[]) { GKBox box; box.boxMin = simd_make_float3(-30.0, -30.0, -30.0); box.boxMax = simd_make_float3(30.0, 30.0, 30.0); GKOctree<NSValue *> *tree = [GKOctree octreeWithBoundingBox:box minimumCellSize:1.0]; for (float x = -1.0; x <= 1.0; x += 1.0) { for (float y = -1.0; y <= 1.0; y += 1.0) { for (float z = -1.0; z <= 1.0; z += 1.0) { simd_float3 point = simd_make_float3(x, y, z); NSValue *value = [NSValue valueWithSCNVector3:SCNVector3FromFloat3(point)]; [tree addElement:value withPoint:point]; } } } for (float x = -1.0; x <= 1.0; x += 1.0) { for (float y = -1.0; y <= 1.0; y += 1.0) { for (float z = -1.0; z <= 1.0; z += 1.0) { printf("Querying for point: %.0f, %.0f, %.0f...\n", x, y, z); simd_float3 point = simd_make_float3(x, y, z); NSArray<NSValue *> *values = [tree elementsAtPoint:point]; for (NSValue *value in values) { SCNVector3 vector = value.SCNVector3Value; printf("Found: %.0f, %.0f, %.0f\n", vector.x, vector.y, vector.z); } } } } return 0;}The idea is that for each queried point there should be only one result, but when I run this code it returns lots of results for each query and I can't figure out why. Can anyone help?
Posted
by Vaelian.
Last updated
.
Post marked as solved
1 Replies
1.6k Views
I'm trying to write a very simple MacOS application that is supposed to forward audio from the default input to the default output. The idea is to understand how to use AVAudioEngine properly, but unfortunately I can't find a way to make this work.Here's the code:- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { _engine = [AVAudioEngine new]; [_engine connect:_engine.inputNode to:_engine.outputNode format:nil]; [_engine prepare]; NSError *error; [_engine startAndReturnError:&error]; }When I run this code I get the following log messages in the console output:2019-12-30 15:56:00.552046+0000 Audio Test[880:25101] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000254280> F8BB1C28-BAE8-11D6-9C31-00039315CD46 2019-12-30 15:56:00.566981+0000 Audio Test[880:25101] HALC_ShellDriverPlugIn::Open: Can't get a pointer to the Open routine 2019-12-30 15:56:00.568909+0000 Audio Test[880:25101] [ddagg] AggregateDevice.mm:790 couldn't get default input device, ID = 0, err = 0! 2019-12-30 15:56:00.582217+0000 Audio Test[880:25101] [avae] AVAEInternal.h:88 required condition is false: [AVAudioEngine.mm:1055:CheckCanPerformIO: (canPerformIO)]Sorry if this is not properly formatted, but I'm blind and the forums are very quirky to use with VoiceOver.
Posted
by Vaelian.
Last updated
.
Post marked as solved
1 Replies
512 Views
I can't find a way to make Xcode 11.3 show my Objective-C class methods in the Symbol Navigator. Everything else works find, but class methods simply won't show, so I'm wondering whether this is a bug. I tried deleting the contents of the DerivedData directory but it didn't solve the problem.
Posted
by Vaelian.
Last updated
.