Post

Replies

Boosts

Views

Activity

Reply to I got a crash while using BGTask / BGAppRefreshTask
Another interesting thing is that I try to test Apple's BGTask demo(https://developer.apple.com/documentation/backgroundtasks/refreshing_and_maintaining_your_app_using_background_tasks ) according to this Apple’s Document: https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development, but every time I got a crash when try to trigger two or more BGTasks in a row, here is the steps I do the test: Put a breakpoint one line after BGTaskScheduler’s submit method in didFinishLaunchingWithOptions. Run my app on my device and put it into background, the code is blocked by the breakpoint. Use _simulateLaunchForTaskWithIdentifier to trigger a BGAppRefreshTask Resume the app, the desired task is called, also the BGTaskScheduler’s submit method is called from this task's launch handler, code is blocked again by the breakpoint I put in step 1. Use _simulateLaunchForTaskWithIdentifier to trigger another BGTask, crash, the description is also *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No launch handler registered for task with identifier {public}@' This crash is almost certain to happen, is it a bug for using iOS's private API?
Feb ’23
Reply to Is gethostbyname safe?
Hi @eskimo, Could you please explain why gethostbyname doesn't work, I thought gethostbyname and getaddrinfo were pretty much the same in my case. Also I would like to confirm that by calling getaddrinfo or CFHostGetAddressing, the system will cache the IP address and use it for the next WKWebView or NSURLRequest to speed up the network request, is that right?
Dec ’22
Reply to Is gethostbyname safe?
I did some automation tests, and in the 480 tests, the first request after the app starts, using gethostbyname can be about 20ms faster on average than without gethostbyname. I have not encountered such crashes myself, but only saw other person's cases in the forum: https://developer.apple.com/forums/thread/711054
Dec ’22