Explore the core architecture of the operating system, including the kernel, memory management, and process scheduling.

Post

Replies

Boosts

Views

Activity

task_for_pid error 5
I'm trying to use task_for_pid in a project but I keep getting error code 5 signaling some kind of signing error. Even with this script I cant seem to get it to work. #include <mach/mach_types.h> #include <stdlib.h> #include <mach/mach.h> #include <mach/mach_error.h> #include <mach/mach_traps.h> #include <stdio.h> int main(int argc, const char * argv[]) {   task_t task;   pid_t pid = argc >= 2 ? atoi(argv[1]) : 1;   kern_return_t error = task_for_pid(mach_task_self(), pid, &task);   printf("%d -> %x [%d - %s]\n", pid, task, error, mach_error_string(error));   return error; } I've tried signing my executables using codesign and also tried building with Xcode with the "Debugging Tool" box checked under hardened runtime. My Info.plist file includes the SecTaskAccess key with the values "allowed" and "debug." Hoping someone can point me towards what I'm missing here. Thanks!
4
0
3.1k
Mar ’22
Your Friend the System Log
The unified system log on Apple platforms gets a lot of stick for being ‘too verbose’. I understand that perspective: If you’re used to a traditional Unix-y system log, you might expect to learn something about an issue by manually looking through the log, and the unified system log is way too chatty for that. However, that’s a small price to pay for all its other benefits. This post is my attempt to explain those benefits, broken up into a series of short bullets. Hopefully, by the end, you’ll understand why I’m best friends with the system log, and why you should be too! If you have questions or comments about this, start a new thread and tag it with OSLog so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Your Friend the System Log Apple’s unified system log is very powerful. If you’re writing code for any Apple platform, and especially if you’re working on low-level code, it pays to become friends with the system log! The Benefits of Having a Such Good Friend The public API for logging is fast and full-featured. And it’s particularly nice in Swift. Logging is fast enough to leave log points [1] enabled in your release build, which makes it easier to debug issues that only show up in the field. The system log is used extensively by the OS itself, allowing you to correlate your log entries with the internal state of the system. Log entries persist for a long time, allowing you to investigate an issue that originated well before you noticed it. Log entries are classified by subsystem, category, and type. Each type has a default disposition, which determines whether that log entry is enable and, if it is, whether it persists in the log store. You can customise this, based on the subsystem, category, and type, in four different ways: Install a configuration profile created by Apple (all platforms). Add an OSLogPreferences property to your app’s Info.plist (all platforms). Run the log tool with the config command (macOS only) Create and install a custom configuration profile with the com.apple.system.logging payload (macOS only). When you log a value, you may tag it as private. These values are omitted from the log by default but you can configure the system to include them. For information on how to do that, see Recording Private Data in the System Log. The Console app displays the system log. On the left, select either your local Mac or an attached iOS device. Console can open and work with log snapshots (.logarchive). It also supports surprisingly sophisticated searching. For instructions on how to set up your search, choose Help > Console Help. Console’s search field supports copy and paste. For example, to set up a search for the subsystem com.foo.bar, paste subsystem:com.foo.bar into the field. Console supports saved searches. Again, Console Help has the details. Console supports viewing log entries in a specific timeframe. By default it shows the last 5 minutes. To change this, select an item in the Showing popup menu in the pane divider. If you have a specific time range of interest, select Custom, enter that range, and click Apply. Instruments has os_log and os_signpost instruments that record log entries in your trace. Use this to correlate the output of other instruments with log points in your code. Instruments can also import a log snapshot. Drop a .logarchive file on to Instruments and it’ll import the log into a trace document, then analyse the log with Instruments’ many cool features. The log command-line tool lets you do all of this and more from Terminal. The log stream subcommand supports multiple output formats. The default format includes column headers that describe the standard fields. The last column holds the log message prefixed by various fields. For example: cloudd: (Network) [com.apple.network:connection] nw_flow_disconnected … In this context: cloudd is the source process. (Network) is the source library. If this isn’t present, the log came from the main executable. [com.apple.network:connection] is the subsystem and category. Not all log entries have these. nw_flow_disconnected … is the actual message. There’s a public API to read back existing log entries, albeit one with significant limitations on iOS (more on that below). Every sysdiagnose log includes a snapshot of the system log, which is ideal for debugging hard-to-reproduce problems. For more details on that, see Using a Sysdiagnose Log to Debug a Hard-to-Reproduce Problem. For general information about sysdiagnose logs, see Bug Reporting > Profiles and Logs. But you don’t have to use sysdiagnose logs. To create a quick snapshot of the system log, run the log tool with the collect subcommand. If you’re investigating recent events, use the --last argument to limit its scope. For example, the following creates a snapshot of log entries from the last 5 minutes: % sudo log collect --last 5m For more information, see: os > Logging OSLog log man page os_log man page (in section 3) os_log man page (in section 5) WWDC 2016 Session 721 Unified Logging and Activity Tracing [1] Well, most log points. If you’re logging thousands of entries per second, the very small overhead for these disabled log points add up. Foster Your Friendship Good friendships take some work on your part, and your friendship with the system log is no exception. Follow these suggestions for getting the most out of the system log. The system log has many friends, and it tries to love them the all equally. Don’t abuse that by logging too much. One key benefit of the system log is that log entries persist for a long time, allowing you to debug issues with their roots in the distant past. But there’s a trade off here: The more you log, the shorter the log window, and the harder it is to debug such problems. Put some thought into your subsystem and category choices. One trick here is to use the same category across multiple subsystems, allowing you to track issues as they cross between subsystems in your product. Or use one subsystem with multiple categories, so you can search on the subsystem to see all your logging and then focus on specific categories when you need to. Don’t use too many unique subsystem and context pairs. As a rough guide: One is fine, ten is OK, 100 is too much. Choose your log types wisely. The documentation for each OSLogType value describes the default behaviour of that value; use that information to guide your choices. Remember that disabled log points have a very low cost. It’s fine to leave chatty logging in your product if it’s disabled by default. No Friend Is Perfect The system log API is hard to wrap. The system log is so efficient because it’s deeply integrated with the compiler. If you wrap the system log API, you undermine that efficiency. For example, a wrapper like this is very inefficient: -*-*-*-*-*- DO NOT DO THIS -*-*-*-*-*- void myLog(const char * format, ...) { va_list ap; va_start(ap, format); char * str = NULL; vasprintf(&str, format, ap); os_log_debug(sLog, "%s", str); free(str); va_end(ap); } -*-*-*-*-*- DO NOT DO THIS -*-*-*-*-*- This is mostly an issue with the C API, because the modern Swift API is nice enough that you rarely need to wrap it. If you do wrap the C API, use a macro and have that pass the arguments through to the underlying os_log_xyz macro. iOS has very limited facilities for reading the system log. Currently, an iOS app can only read entries created by that specific process, using .currentProcessIdentifier scope. This is annoying if, say, the app crashed and you want to know what it was doing before the crash. What you need is a way to get all log entries written by your app (r. 57880434). There are two known bugs with the .currentProcessIdentifier scope. The first is that the .reverse option doesn’t work (r. 87622922). You always get log entries in forward order. The second is that the getEntries(with:at:matching:) method doesn’t honour its position argument (r. 87416514). You always get all available log entries. Xcode 15 beta has a shiny new console interface. For the details, watch WWDC 2023 Session 10226 Debug with structured logging. For some other notes about this change, search the Xcode 15 Beta Release Notes for 109380695. In older versions of Xcode the console pane was not a system log client (r. 32863680). Rather, it just collected and displayed stdout and stderr from your process. This approach had a number of consequences: The system log does not, by default, log to stderr. Xcode enabled this by setting an environment variable, OS_ACTIVITY_DT_MODE. The existence and behaviour of this environment variable is an implementation detail and not something that you should rely on. Xcode sets this environment variable when you run your program from Xcode (Product > Run). It can’t set it when you attach to a running process (Debug > Attach to Process). Xcode’s Console pane does not support the sophisticated filtering you’d expect in a system log client. When I can’t use Xcode 15, I work around the last two by ignoring the console pane and instead running Console and viewing my log entries there. If you don’t see the expected log entries in Console, make sure that you have Action > Include Info Messages and Action > Include Debug Messages enabled. The system log interface is available within the kernel but it has some serious limitations. Here’s the ones that I’m aware of: Prior to macOS 14.4, there was no subsystem or category support (r. 28948441). There is no support for annotations like {public} and {private}. Adding such annotations causes the log entry to be dropped (r. 40636781). The system log interface is also available to DriverKit drivers. For more advice on that front, see this thread. Metal shaders can log using the interface described in section 6.19 of the Metal Shading Language Specification. Revision History 2025-02-20 Added some info about DriverKit. 2024-10-22 Added some notes on interpreting the output from log stream. 2024-09-17 The kernel now includes subsystem and category support. 2024-09-16 Added a link to the the Metal logging interface. 2023-10-20 Added some Instruments tidbits. 2023-10-13 Described a second known bug with the .currentProcessIdentifier scope. Added a link to Using a Sysdiagnose Log to Debug a Hard-to-Reproduce Problem. 2023-08-28 Described a known bug with the .reverse option in .currentProcessIdentifier scope. 2023-06-12 Added a call-out to the Xcode 15 Beta Release Notes. 2023-06-06 Updated to reference WWDC 2023 Session 10226. Added some notes about the kernel’s system log support. 2023-03-22 Made some minor editorial changes. 2023-03-13 Reworked the Xcode discussion to mention OS_ACTIVITY_DT_MODE. 2022-10-26 Called out the Showing popup in Console and the --last argument to log collect. 2022-10-06 Added a link WWDC 2016 Session 721 Unified Logging and Activity Tracing. 2022-08-19 Add a link to Recording Private Data in the System Log. 2022-08-11 Added a bunch of hints and tips. 2022-06-23 Added the Foster Your Friendship section. Made other editorial changes. 2022-05-12 First posted.
0
0
8.5k
May ’22
Opening the Extension menu in the System Preferences
Hi there, I have two extension in my App, a Finder Sync and a Share Extension. Because these are disabled by default and automatically enabling them is, according to my extensive research, not possible, I want to provide an easy way for the user to enable the extensions when the app is opened. I am currently displaying a popup, with a button to open the preferences. I have struggled with this a bit, by now I managed to open the main preferences window using NSWorkspace.shared.open(URL(string: "x-apple.systempreferences:com.apple.preference")!) which is rather suboptimal though, since the user has to select the extensions option manually and isn't directly redirected there. What I have also found is that the menu of the FinderSyncExtension can be opened directly by using FIFinderSyncController.showExtensionManagementInterface() which is unfortunately suboptimal as well, because it only shows the managment interface of the finder extension and not the overview of all extensions. Is there any way to either enable the extensions programatically, or if not, is there a way to show the "Added Extensions" portion of the Extensions menu in the system preferences?
7
1
4.2k
Sep ’22
Partial fix for widgets & complications not showing correctly
I recently raised this post explaining how I couldn't seem to get watchOS 9 complications to work, and I've figured out a partial fix. The original post details the issues with complications - and some are still valid - but this fix applies to both my complications and Home Screen / Lock Screen widgets. I was following the various WWDC 2020/2022 videos and the Emoji Rangers sample code, adding bits here and there, and assuming they were completely valid. Sadly, this bit of code in the widget's dynamic intents IntentTimelineProvider getTimeline really just banjaxed everything: // Create entries for one day, 15 minutes apart let currentDate = Date() for minuteOffset in stride(from: 0, to: 60 * 60 * 24, by: 15) { let entryDate = Calendar.current.date(byAdding: .minute, value: minuteOffset, to: currentDate)! entries.append(EventEntry(date: entryDate, event: event)) } If I remove that, and generate a different timeline with specific dates and times (for example: now, in 10 mins, in 2 hours, in a day, etc.) the complications appear correctly, as do Home Screen and Lock Screen widgets. The outstanding issues with complications are: The previews all use the same data, but getSnapshot() is supposed to return the data specific to that event from the configuration, i.e. if let theId = configuration.event?.identifier. "Christmas" is correct, but "Gallery Opening" is using Christmas's data. Once I've selected the event I want to use in a complication the edit screen shows it as totally blank, not even a placeholder: I hope this little fix works for you guys. And, if you know how to fix the above issues, let me know. (iOS 16.1 beta 1, Xcode 14.1 beta 1)
1
1
2.5k
Sep ’22
Live Activity Not Working on Physical Device
I am playing around with Live Activities and got everything working on the iOS 16.1 beta 2 simulator using Xcode 14.1 beta 2 (14B5024i). However, running the same code on a real physical device (iPhone X) running iOS 16.1 beta 2 does not show the Live Activity on the lock screen at all. 😵 Did anyone get their Live Activity working on a real device yet, or is this an issue with the current beta? Things I have already checked: ActivityAuthorizationInfo().areActivitiesEnabled returns true on my physical device let activity = try Activity.request(...) successfully completes without throwing and I can see the activity.id printed to the console Other live activities - such as the iOS system timer activity - do show up on my physical device just fine
15
0
10k
Sep ’22
DriverKit: Check that driver is enabled on iPadOS
Apple Docs mentions that driver should be approved(enabled) in Settings app. I wonder is there any API available to check that driver is not enabled? To my mind, App with driver should have a following flow: Run App Check that driver is(not) enabled Display message(alert) and ask to enable driver in Settings. Optionally: provide shortcut to exact Settings page Unfortunately, it's not obvious how to check that driver is enabled.
3
0
1.3k
Nov ’22
iOS16.1 Connection Interval Changes?
Hello, When Apple officially released iOS16 to users in Sept and Oct this year, our custom device that uses a nRF52832 Nordic based BLE chip would no longer hold the connection for more that 90 seconds before disconnecting. Through other forums and documentation, we realized that with iOS16, Apple changed their requested Connection Intervals and we had to modify them on our product to solve. [Previously Worked with iOS15 & below] Connection Interval for Product: Min 7.5ms - Max 15ms Does not work with iOS16.0 Does work with iOS16.1 & iOS16.1.1 [Had to Change for iOS16.0, 16.0.1, 16.0.2, 16.0.3] Connection Interval for Product: Min 15ms - Max 30ms However, with the release of iOS16.1 in November, our original connection interval parameters work again. Does anyone know what Apple changed for iOS16.1 for the connection intervals? Why does iOS16.1 accept 7.5-15ms intervals when iOS16.0 doesn't? There are no changes to the connection interval requirements on the Apple Design Guidelines as of the last revision Oct26th,2022. Would really appreciate if anyone can share more info on the BLE change logs for iOS16.1. Thanks for the help!
1
0
1.8k
Nov ’22
Xcode Cloud macOS won't run test scheme - "Failed to load the test bundle"
I'm new to Xcode cloud - working with a Mac OS app, build is working great. Now I am trying to add a Test action; the testing target builds but won't run, and the error indicates it can't find the testing bundle in the expected build output. There's also mention of a code signing error, but I have automatic code signing enabled with the same settings on test target as the app. I am only running the unit test (XCTest) scheme, not the UI tests. When I run it locally from the IDE it works fine, either selecting the test scheme explicitly or as the test step of the app scheme. I notice the XCTest target's scheme setup uses Debug builds and expects the test output to be in the Debug .app bundle, I thought perhaps that was the problem (in case only the release app bundle actually gets built in the Xcode Cloud environment). So I created a duplicate scheme and set the build targets to Release - again I can run this fine locally (after creating a release build), but it fails with the same error in Xcode cloud. I also tried changing the code signing certificate from "Development" to "Sign to run locally" to see if that made a difference, but I get the same error. (It's using my developer account Team, and "Automatically manage signing".) Can anyone relate the proper way to set up an XCTest scheme so that the tests will actually run in a Mac OS Xcode Cloud workflow? I'm using Xcode 14.0.1. Here's the full error output, with [AppName] and [TestTargetName] substituted for the actual: [AppName] (....) encountered an error (Failed to load the test bundle. If you believe this error represents a bug, please attach the result bundle at /Volumes/workspace/resultbundle.xcresult. (Underlying Error: The bundle “[TestTargetName]” couldn’t be loaded. The bundle couldn’t be loaded. Try reinstalling the bundle. dlopen(/Volumes/workspace/TestProducts/Debug/[AppName].app/Contents/PlugIns/[TestTargetName].xctest/Contents/MacOS/[TestTargetName], 0x0109): tried: '/Volumes/workspace/TestProducts/Debug/[TestTargetName]' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/[TestTargetName]' (no such file), '/Volumes/workspace/TestProducts/Debug/[AppName].app/Contents/PlugIns/[TestTargetName].xctest/Contents/MacOS/[TestTargetName]' (code signature in <....> '/Volumes/workspace/TestProducts/Debug/[AppName].app/Contents/PlugIns/[TestTargetName].xctest/Contents/MacOS/[TestTargetName]' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)))) Thanks!
11
3
4.9k
Dec ’22
Clearing activation lock returns 404 not found
The api url :https://deviceservices-external.apple.com/deviceservicesworkers/escrowKeyUnlock The document url: https://developer.apple.com/documentation/devicemanagement/device_assignment/activation_lock_a_device/creating_and_using_bypass_codes We use the api for past 1+ years, it works well. The api returns 404 not found response since 2022.12.02 <title>404 Not Found</title> </head> <body> <center> <h1>404 Not Found</h1> </center> <hr> <center>Apple</center> </body> </html> We contact apple support via email, but no useful response;
3
0
1.5k
Dec ’22
Bluetooth L2CAP iOS
Hi, I have 2 questions: the api for L2CAP is only for BLE or can also work for BR/EDR? (currently didn't manage to connect with BR/EDR) I use https://github.com/bluekitchen/CBL2CAPChannel-Demo on iPhone with le_credit_based_flow_control_mode from blue kitchen and the throughput was very low. I also tried to use L2TEST from Bluez (which uses L2CAP BASIC MODE) but it failed to connect Can anybody help how to increase throughput? The best result I received was 18 kilobyte/second. Thank you
2
0
1.7k
Jan ’23
Illegal instruction in std::remainder (libsystem_m.dylib) when floating point exceptions enabled on M1 mac
Call to std::remainder(double(411.0), int(365)); results in a crash due to a nan in libsystem_m.dylib. MCVE program is provided + lldb backtrace and system report. $ clang++ -g -arch arm64 -std=c++20 main.cpp -o test $ ./test ori_fpcr=0, new_fpcr=1792 std::fmod(simTimeInDays, numDays) = 46 Illegal instruction: 4 main.cpp #include <cassert> #include <cfenv> #include <cmath> #include <iostream> #if !defined(__arm64__) || !defined(__APPLE__) # error "Meant to be run on arm64 apple" #endif inline int feenableexcept(unsigned int excepts) { static fenv_t fenv; if (std::fegetenv(&fenv) != 0) { return -1; } const unsigned long long old_fpcr = fenv.__fpcr; const unsigned int old_excepts = (old_fpcr >> 8u) & unsigned(FE_ALL_EXCEPT); // Check the bits passed are valid, and bit shift them const unsigned int new_excepts = excepts & unsigned(FE_ALL_EXCEPT); const unsigned long long new_fpcr = new_excepts << 8u; // Set the new bits fenv.__fpcr = fenv.__fpcr | new_fpcr; return (std::fesetenv(&fenv) != 0) ? -1 : static_cast<int>(old_excepts); } int main([[maybe_unused]] int argc, [[maybe_unused]] const char** argv) { constexpr unsigned int flags = FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW; static_assert(flags == 7); constexpr uint32_t fpcr_flags_shifted = flags << 8; constexpr uint32_t fpcr_flags = (__fpcr_trap_divbyzero | __fpcr_trap_invalid | __fpcr_trap_overflow); static_assert(fpcr_flags_shifted == fpcr_flags); static_assert(fpcr_flags_shifted == 1792); uint32_t ori_fpcr = __builtin_arm_rsr("fpcr"); feenableexcept(flags); uint32_t new_fpcr = __builtin_arm_rsr("fpcr"); // std::cout << "(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW) = " << flags << '\n'; // std::cout << "((FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW) << 8) = " << fpcr_flags_shifted << '\n'; // std::cout << "(__fpcr_trap_divbyzero | __fpcr_trap_invalid | __fpcr_trap_overflow) = " << fpcr_flags << '\n'; std::cout << "ori_fpcr=" << ori_fpcr << ", new_fpcr=" << new_fpcr << '\n'; const double simTimeInDays = 411.0; const int numDays = 365; // This is fine std::cout << "std::fmod(simTimeInDays, numDays) = " << std::fmod(simTimeInDays, numDays) << '\n'; // This isn't std::cout << "std::fmod(simTimeInDays, numDays) = " << std::remainder(simTimeInDays, numDays) << '\n'; return 0; } backtrace: see attachment lldb_backtrace.txt $ system_profiler SPSoftwareDataType SPHardwareDataType Software: System Software Overview: System Version: macOS 13.2 (22D49) Kernel Version: Darwin 22.3.0 Boot Volume: Macintosh HD Boot Mode: Normal Secure Virtual Memory: Enabled System Integrity Protection: Enabled Time since boot: 7 hours, 58 minutes Hardware: Hardware Overview: Model Name: MacBook Pro Model Identifier: MacBookPro18,2 Model Number: Z14V000NBFN/A Chip: Apple M1 Max Total Number of Cores: 10 (8 performance and 2 efficiency) Memory: 64 GB System Firmware Version: 8419.80.7 OS Loader Version: 8419.80.7 Activation Lock Status: Enabled $ otool -L test test: /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0 $ clang++ --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.3.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
1
0
1.1k
Jan ’23
iOS 16 Crash _os_unfair_lock_recursive_abort
I found a lot of crashes on iOS 16,the detail infomation: Exception Type:  EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x000000020f3d108c Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [18104] Triggered by Thread:  0 Thread 0 name: Thread 0 Crashed: 0   libsystem_platform.dylib      0x000000020f3d108c _os_unfair_lock_recursive_abort + 36 (lock.c:508) 1   libsystem_platform.dylib      0x000000020f3cb898 _os_unfair_lock_lock_slow + 280 (lock.c:567) 2   libobjc.A.dylib               0x00000001ba6939b4 lookUpImpOrForward + 156 (lock_private.h:716) 3   libobjc.A.dylib               0x00000001ba68e0c4 _objc_msgSend_uncached + 68 (:-1) 4   myApp                        0x00000001005e8d04 post_crash_callback + 64 (XBPLCrashManager.m:122) 5   myApp                        0x0000000101453744 signal_handler_callback + 184 (PLCrashReporter.m:237) 6   myApp                        0x000000010144fc6c internal_callback_iterator(int, __siginfo*, __darwin_ucontext*, void*) + 140 (PLCrashSignalHandler.mm:0) 7   myApp                        0x000000010144fbc0 plcrash_signal_handler + 24 (PLCrashSignalHandler.mm:201) 8   libsystem_platform.dylib      0x000000020f3cca90 _sigtramp + 56 (sigtramp.c:116) 9   libsystem_kernel.dylib        0x00000001fed74bf0 abort_with_payload_wrapper_internal + 104 (terminate_with_reason.c:102) 10  libsystem_kernel.dylib        0x00000001fed74b88 abort_with_reason + 32 (terminate_with_reason.c:116) 11  libobjc.A.dylib               0x00000001ba6bfa5c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 116 (objc-errors.mm:199) 12  libobjc.A.dylib               0x00000001ba6bf9e8 _objc_fatal(char const*, ...) + 32 (objc-errors.mm:215) 13  libobjc.A.dylib               0x00000001ba6bf978 cache_t::bad_cache(objc_object*, objc_selector*) + 228 (objc-cache.mm:829) 14  libobjc.A.dylib               0x00000001ba6944f0 cache_t::insert(objc_selector*, void (*)(), objc_object*) + 296 (objc-cache.mm:901) 15  libobjc.A.dylib               0x00000001ba693ba8 lookUpImpOrForward + 656 (objc-runtime-new.mm:6739) 16  libobjc.A.dylib               0x00000001ba68e0c4 _objc_msgSend_uncached + 68 (:-1) 17  UIKitCore                     0x00000001c36f9ad8 -[UIViewController initWithNibName:bundle:] + 216 (UIViewController.m:2671) 18  myApp                        0x0000000100d78088 -[myUIBaseViewController init] + 44 (myUIBaseViewController.m:60) 19  myApp                        0x000000010031f744 -[XBSCLaunchManager makeTabBarViewController] + 2600 (XBSCLaunchManager.m:432) 20  myApp                        0x000000010032022c -[XBSCLaunchManager showTabbarViewController] + 292 (XBSCLaunchManager.m:569) 21  libdispatch.dylib             0x00000001c89ecfdc _dispatch_client_callout + 20 (object.m:560) 22  libdispatch.dylib             0x00000001c89f046c _dispatch_continuation_pop + 504 (inline_internal.h:2632) 23  libdispatch.dylib             0x00000001c8a03a58 _dispatch_source_invoke + 1588 (source.c:596) 24  libdispatch.dylib             0x00000001c89fb748 _dispatch_main_queue_drain + 756 (inline_internal.h:0) 25  libdispatch.dylib             0x00000001c89fb444 _dispatch_main_queue_callback_4CF + 44 (queue.c:7887) 26  CoreFoundation                0x00000001c146a6d8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780) 27  CoreFoundation                0x00000001c144c03c __CFRunLoopRun + 2036 (CFRunLoop.c:3147) 28  CoreFoundation                0x00000001c1450ec0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 29  GraphicsServices              0x00000001fb4a7368 GSEventRunModal + 164 (GSEvent.c:2196) 30  UIKitCore                     0x00000001c394686c -[UIApplication _run] + 888 (UIApplication.m:3754) 31  UIKitCore                     0x00000001c39464d0 UIApplicationMain + 340 (UIApplication.m:5344) 32  myApp                        0x0000000100330b5c main + 88 (main.m:14) 33  dyld                          0x00000001dfc72960 start + 2528 (dyldMain.cpp:1170)  Request for help on advice prevention and fix for this. Thanks
3
1
2.7k
Feb ’23
Catching SIGTERM in daemon
I have a process that I start and keep alive like this. ServerMain.shared.startFSM() CFRunLoopRun() Now I’m trying to react accordingly to when the computer is going to sleep, or shutting down so I’m trying to catch the SIGTERM signal as follows. private func setSIGTERMSignalHandler() { let signalSource = DispatchSource.makeSignalSource(signal: SIGTERM, queue: .main) signalSource.setEventHandler { self.signOut() } signalSource.resume() signTermSource = signalSource } However the event handler is not getting called in any circumstance. Is this the right track to catch them since it is a LaunchDaemon?
4
0
1.3k
Feb ’23
Finishing a HKLiveWorkoutBuilder workout with lots of HKWorkoutActivity instances is very slow
I'm using the new watchOS 9 HKWorkoutActivity in my interval training app (Intervals Pro) for each interval. It's a great addition since all the intervals now show in the Apple Fitness app, however, if the workout has lots of activities then saving the workout is painfully slow. For example, on my Apple Watch Ultra I saved a workout with 63 activities and it took more than 1 minute. Here's a code snippet: try await builder.endCollection(at: workoutEndDate) try await builder.addMetadata(metadata) try await builder.finishWorkout() // This is SLOW Is anyone else having the same issue? To demonstrate the issue you can look at a Test Flight build of Intervals Pro: https://testflight.apple.com/join/Nn7iSOzY Tap on the More tab in the iPhone app and then the Apple Watch Settings. On that screen you'll see a switch to either enable or disable workout activities. To demonstrate the issue, edit a timer to continue until manually stopped by changing the Number of Cycles to "Until Stopped". Then start the timer on the watch. Let it run for a period of time to create more than 50 intervals, for example, then stop the timer. Swipe to the leftmost screen on the watch, tap pause, then tap end. At that point you'll see how slow the workout saved. Next, you can go back to the iPhone app, disable using workout activities and repeat the test. The workout will save quickly in this case. I've filed a feedback.
2
0
1.1k
Mar ’23
CryptoTokenKit and headless environments
Hi there, I could not find any previous post about this so I figured I should open one. It looks like the use of CryptoTokenKit modules (whether SmartCard or Persistent ones) is hindered on headless environments. This was observed on AWS backed macOS machines, and also on actual physical machines when using CI/CD tools with no GUI access. My first guess is that this is due to the fact that loading the CTK Extension relies on running the GUI CTK App, which is not possible in pure headless fashion. The bug report FB12135879 was filled in this regard. Any input on this would be appreciated. Thanks,
3
0
1.4k
Apr ’23
Application must be updated by the developer issue
Hi All, I am facing with ****** issue, searched through many similar topics, but did not find solution, hope someone can help me! Common information: iOS VPN application min. deployment iOS 15.0 Xcode 14.2 Testing on iPhone with iOS 16.0.2 / 15.5 Problem description Application is builded, installed on iPhone and launched from XCode. After a new VPN configuration is added by application using NETunnelProviderManager. No errors are occurred during all this steps. However I can not enable VPN and in VPN settings I observe "Update required" message: "Application must be updated by the developer before VPN can be connected"
8
1
1.5k
May ’23
Unable to open settings app from custom app
I am able to open software update section of settings app from my custom app. But when settings app is already opened with other section other than software update. Settings app opens with previous section & not opens with software update section. Issue is in iOS 16.4.1 Below is my code: if let url = URL(string: "App-prefs:root=Settings&path=General/SOFTWARE_UPDATE_LINK") { UIApplication.shared.open(url) } I also have did some modification in info section of project & below is screen shot attached.
2
1
455
May ’23