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

Post

Replies

Boosts

Views

Activity

Crash on [AVPlayer _addLayer] in iOS 16 caused by Pegasus
Hi, Our apps currently facing a crash that only happens in iPhone with iOS 16. Unfortunately, we could not reproduce this issue, neither from XCode build or App store build. From third party crash analytics, it happens mostly of background and they highlighted this as the issue. Fatal Exception: NSInvalidArgumentException *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil And the stack trace, it shows: AVFCore __22-[AVPlayer _addLayer:]_block_invoke Pegasus __116-[PGPictureInPictureProxy _endDeactivatingPictureInPictureIfNeededWithAnimationType:stopReason:cleanupHandlerOrNil:]_block_invoke We also attach the full crash log to give full context of the crash. Any idea why this crash happens and is there anything i can do to prevent the crashes from happening again? pegasus.crash
14
6
4.5k
Oct ’22
Encountering Error Domain=NSCocoaErrorDomain Code=513 while creating hard link between files on MacOS(Mac Catalyst App)
Hi, I am trying to create a hard link on MacOS(Mac Catalyst App) between files using [self linkItemAtURL:fromURL toURL:toURL error:&error]; Source Path for MacOS - /var/folders/lf/dt_4nxd945jdry2241phx0_40000gn/T/net.appname.AppName/documents/... Destination Path for MacOS - /Users/username/Library/Group Containers/group.net.appname.AppName.shared/Message/Media/... Although the same code works fine on iOS, but getting following error on MacOS Error Domain=NSCocoaErrorDomain Code=513 couldn’t be linked because you don’t have permission to access, Operation not permitted Source Path for iOS - /Users/user/Library/Developer/CoreSimulator/Devices/B4054540-345F-4D90-A3C5-DA6E6469A3FC/data/Containers/Data/Application/B4AB7D70-491C-49E5-9A3F-27E66EC3423D/tmp/documents/... Destination Path for iOS - /Users/user/Library/Developer/CoreSimulator/Devices/B4054540-345F-4D90-A3C5-DA6E6469A3FC/data/Containers/Shared/AppGroup/842B248E-CCA6-4B5C-82BD-2858EADD3A90/Message/Media/... However, interestingly if I try to copy the file, it works perfectly fine on MacOS as well. I am unable to understand if it is the permission issue, it should not work with copy as well. Does anyone have any reason/solution to this behaviour?
5
0
1.4k
Oct ’22
Bluetooth issue of macOS Ventura
Always failed to add IOBluetoothSDPServiceRecord in macOS Ventura As the title said, after I called the method "publishedServiceRecordWithDictionary", the Bluetooth XPC connection would always be interrupted and reset. The same code that I run in macOS Monterey is well executed without any warning. And I got the following logs : [CoreBluetooth] XPC connection interrupted, resetting [IOBluetooth] Failed to add service record [CoreBluetooth] XPC connection interrupted, resetting [CoreBluetooth] XPC connection interrupted, resetting [CoreBluetooth] XPC connection interrupted, resetting [CoreBluetooth] XPC connection interrupted, resetting
8
1
2.9k
Oct ’22
XCode 14.x, adding Watch to existing and WCSession isWatchAppInstalled = false
I added a Watch app to an existing iOS app using XCode 14.1. (single target template) When using WCSession delegate, so I can message between the apps, I always get isWatchAppInstalled = false. If Icreate the same scenario using XCode 13.x, I have no issues. Has anyone been able to add a watch app to an existing iOS app, create a WCSession object and have isWatchAppInstalled = true? print("Session:activationDidCompleteWith --> IsPaired[(String(describing: session.isPaired))] isWatchAppInstalled[(String(describing: session.isWatchAppInstalled))] isReachable[(String(describing: session.isReachable))]"); displays: Session:activationDidCompleteWith --> IsPaired[true] isWatchAppInstalled[false] isReachable[false]
1
0
1.2k
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.6k
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!
10
3
4.3k
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.3k
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.4k
Jan ’23
Runtime error when using StoreKit 2
When performing StoreKit 2 operations in my Mac app, even very simple ones like AppStore.sync() a small but steady percentage of users experiences the following error: systemError(Error Domain=NSCocoaErrorDomain Code=4097 \"connection to service named com.apple.storekitagent\" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent}) Rebooting or re-downloading the App from the Mac App Store, as well as signing out and in again on the Mac App Store does not solve the issue. Strangely enough all of the affected users I'm aware of were initially able to perform In-App purchases via the said app. Without any updates or anything else however suddenly after a restart of the app the above error gets thrown by the system. As I have not found any way to solve this issue yet and the said customers are consequently left without service even though they are paying customers, I am desperate to find help with this issue. Given the simplicity of the AppStore.sync() method for example I can't imagine the solution to lie in code, but I might of course be wrong. Thank you, Bastian
2
0
1.2k
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
929
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.2k
Feb ’23
Strong Password Autofill not allow custom password
Hi, we are facing on a strange behaviour since iOS 16. In a registration view, we have two text field to insert password (password textfield and confirm password text field). Suggest strong password is abilitate (from iCloud... password & keychain). When user tap on password text field, can choose between strong password or text custom password. If user choose custom password, can text his own password as usually. But when he tap the second text field (confirm password) Apple fill in automatic both text field, cleaning the first text field... So user entry in a loop where he text password and when go next, previous textfield be cleaned and both text field filled with a new suggestion. Searching on the web we don't find any solution to it. Also because we try just to set text fields as .password or .newPassword. But this behaviour is always the same. Maybe is it a bug of iOS 16? How we can allow user to chose a custom password if the system fill always in automatic the password text fields, every time he tap on them?
6
3
2.9k
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.1k
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
943
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.3k
Apr ’23
Calling IOBluetoothSDPServiceRecord.publishedServiceRecord crashes bluetoothd
Hi, I have an App KeyPad that lets you use your mac keyboard as a bluetooth keyboard for your iPhone, TV, iPad, another Mac, Windows PC. https://apps.apple.com/us/app/keypad-bluetooth-keyboard/id1491684442?mt=12 Ever since the release of MacOS Ventura this app is no longer working. I have raised feedback report in december, and there is no activity on it. FB11869248 Essentially if I call publishedServiceRecord with a 16bit UUID in "0001 - ServiceClassIDList" the bluetoothd crashes and kills all bluetooth connections (Mouse, keyboard, headset...everything) and then reconnects. This is 100% reproducible. What is interesting is that if a user installs my App on MacOS Monterey, it works, and if they upgrade to MacOS Ventura, it will continue to work. But if they install it new in Ventura it will not work. Even more interesting, because my app was installed in Monterey, all OTHER similar apps will work on Ventura. I suspect that this is some sort of permission issue but I am not getting any support. Anybody see something similar. Sam
1
0
937
May ’23