Objective-C

RSS for tag

Objective-C is a programming language for writing iOS, iPad OS, and macOS apps.

Posts under Objective-C tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

macOS app crashes on first launch from TestFlight
2024_06_09_testflight_launch_crash_log.txt Running my macOS app the first time after installing via TestFlight crashes on launch. Every subsequent run works fine (including completely quitting the app and re-running it). Also, building and running directly in XCode both in Debug and Release mode works fine. I'm on a Mac M2 and the app excludes x86_64 arch. Here is the trimmed crash log (sanitised full log is attached) Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: CamHero-macOS-v2-Release [12876] Application Specific Information: abort() called Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x18c81d11c __pthread_kill + 8 1 libsystem_pthread.dylib 0x18c854cc0 pthread_kill + 288 2 libsystem_c.dylib 0x18c764a40 abort + 180 3 libglib-2.0.0.dylib 0x1061e5bd0 g_assertion_message + 464 4 libglib-2.0.0.dylib 0x1061e5c44 g_assertion_message_expr + 116 5 libgstlibav.dylib 0x10549ede0 gst_ffmpeg_cfg_init + 776 6 libgstlibav.dylib 0x10548a4f4 plugin_init + 140 7 libgstreamer-1.0.0.dylib 0x10646a458 gst_plugin_register_func + 636 8 libgstreamer-1.0.0.dylib 0x106469fe4 gst_plugin_register_static + 212 9 libgstlibav.dylib 0x10548a45c gst_plugin_libav_register + 92 10 CamHero-macOS-v2-Release 0x104a01624 gst_ios_init + 900 (gst_ios_init.m:1072) 11 CamHero-macOS-v2-Release 0x104a80590 specialized CamHeroMacOSApp.init() + 68 (CamHeroMacOSApp.swift:19) 12 CamHero-macOS-v2-Release 0x104a804a4 CamHeroMacOSApp.init() + 4 [inlined] 13 CamHero-macOS-v2-Release 0x104a804a4 protocol witness for App.init() in conformance CamHeroMacOSApp + 20 (<compiler-generated>:16) 14 SwiftUI 0x1b7f134e0 0x1b7163000 + 14353632 15 CamHero-macOS-v2-Release 0x104a804d8 static CamHeroMacOSApp.$main() + 24 [inlined] 16 CamHero-macOS-v2-Release 0x104a804d8 main + 36 17 dyld 0x18c4d90e0 start + 2360 Thread 1: 0 libsystem_pthread.dylib 0x18c84fe28 start_wqthread + 0 Thread 2: 0 libsystem_pthread.dylib 0x18c84fe28 start_wqthread + 0 Thread 0 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0x0000600000755680 x5: 0x0000000000000020 x6: 0x0000600000755680 x7: 0xffffffff00008600 x8: 0x8ddd1ea266cd729b x9: 0x8ddd1ea3846d2c5b x10: 0x0000000000001620 x11: 0x00000000dbe367fb x12: 0x00000000000007fb x13: 0x00000000000007fd x14: 0x00000000dc03683c x15: 0x000000000000003c x16: 0x0000000000000148 x17: 0x00000001eb9f3da0 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x00000001e2a05ec0 x21: 0x0000000000000103 x22: 0x00000001e2a05fa0 x23: 0x000000016b407508 x24: 0x0000000000000000 x25: 0x00000001064f8450 x26: 0x000060000080d511 x27: 0x0000000000000000 x28: 0x0000000000000000 fp: 0x000000016b407460 lr: 0x000000018c854cc0 sp: 0x000000016b407440 pc: 0x000000018c81d11c cpsr: 0x40001000 far: 0x0000000000000000 esr: 0x56000080 Address size fault It seems that the initialisation of one of the gstreamer plug-ins doesn't go well. But, I wonder what might lead to that happening only the first time after launch? Will appreciate any clues! EDIT / UPDATE: If i remove the app completely and install the same version again from TestFlight, app doesn't crash. So it seems the crashing is limited to the very first launch of a new /updated version.
1
0
166
4d
How do you allow an XPC service to create a new file based on an NSURL that the user selected from an NSSavePanel?
How do you send an NSURL representing a new file, as returned from an NSSavePanel, to an XPC service such that the service is granted permission to create the file? I can successfully pass an NSURL to the XPC process if the NSURL represents an existing file. This is documented in Apple's Documentation: Share file access between processes with URL bookmarks This involves creating bookmark date while passing 0 in as the options. However, if you try to create bookmark data for an NSURL that represents a file that is not yet created, you do not get any bookmark data back and an error is returned instead: Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist." Simply passing the file path to the XPC process, by way of: xpc_dictionary_set_string(message, "file_path", url.fileSystemRepresentation); Does not grant the XPC create/write permissions. Is there an API or trick I'm missing? Note that the user should be allowed to save and create new files anywhere of their choosing, thus restricting URLs to only those within a group or container shared between the app and service isn't really viable. Using the latest of everything on macOS with the xpc_session API...
1
0
127
6d
NSString.getBytes does not crash even when an invalid range is passed.
When we pass some special words, NSString.getBytes does not crash even when we pass an invalid range. It seems a bug. The below code is an example. func testNSStringGetBytes() { let originalString: String = "􁜁あ" let bufferSize = 256 var buffer = [UInt8](repeating: 0, count: bufferSize) var usedLength = 0 // An invalid range is passed let range = NSRange(location: 0, length: originalString.count + 1) var remainingRange = NSRange() (originalString as NSString) .getBytes( &buffer, maxLength: bufferSize, usedLength: &usedLength, encoding: String.Encoding.utf8.rawValue, options: [], range: range, remaining: &remainingRange ) print("Used Length: \(usedLength)") print("Buffer: \(buffer[0..<usedLength])") if remainingRange.length > 0 { print("Did not convert the whole string. Remaining range: \(remainingRange)") } else { print("Entire string was converted successfully.") } }
1
0
165
6d
Archiving my macOS target app fails with BOOL error
I'm building a macOS target for my App (which also has some Obj-C code). Building and running the app is fine but when I archive the app in XCode, the process / build fails with the following error Type 'BOOL' (aka ;Int32') cannot be used as a boolean;test for '!=0' instead It happens in a couple of places, one of the places being private func getRootDirectory(createIfNotExists: Bool = true) throws -> URL { return try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true) } where it complains that create: true is not acceptable and throws the above error. If I comment out this line, the archive works successfully. When i Cmd + click the definition of Filemanager.default.url , i get this @available(macOS 10.6, *) open func url(for directory: FileManager.SearchPathDirectory, in domain: FileManager.SearchPathDomainMask, appropriateFor url: URL?, create shouldCreate: BOOL) throws -> URL This looks fishy since it it says create shouldCreate: BOOL whereas the documentation says it should be just Bool func url( for directory: FileManager.SearchPathDirectory, in domain: FileManager.SearchPathDomainMask, appropriateFor url: URL?, create shouldCreate: Bool ) throws -> URL My minimum deployment target is macOS 13.0 I'm quite stumped at this error - which happens only while archiving. Does anybody know why?
4
0
231
1w
How activate window correctly using activationPolicy
I have the following code: + (BOOL)activateWindow:(NSWindow*)window { if (NSApp.activationPolicy != NSApplicationActivationPolicyRegular) [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; if (window) { [NSApp activate]; //if (window.isMiniaturized) [window deminiaturize:nil]; [window makeKeyAndOrderFront:nil]; } return YES; } + (BOOL)hideWindowFromDock:(NSWindow*)window { if (NSApp.activationPolicy != NSApplicationActivationPolicyProhibited) [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited]; window.isVisible = NO; return YES; } I hide app main window by setting NSApplicationActivationPolicyProhibited if it is minimized or being closed. The code worked most of the time. But since upgrading to Sonoma, sometimes it won't correctly activate main window. The window icon reappears in the dock, but the window won't show up. I have to click on the window icon again to let it 'order front'. Sometimes, I observe a very weird behavior of the window being activated. It 'order front' and then disappears and re-appears.
1
0
200
1w
Problem with setNeedsDisplay:
Hi, with the default values the rotation take place but changing the value not. I bind a button to a slider action: -(IBAction)rotateXAction:(id)sender { NSLog(@"%@ \n",sender); BOOL yn = YES; _rotationX = [_sliderX intValue]; if(yn) printf("rotationX %d \n",_rotationX); // value o.k [self setNeedsDisplay:YES]; } The drawRect: will not be called. What is wrong with my code, please tell me. Uwe
1
0
280
1w
Cannot get NSTimer working in another thread
I need to create timers in another thread (not on main): @implementation AppDelegate { NSThread* _worker; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { _worker = [[NSThread alloc] initWithTarget:self selector:@selector(main) object:nil]; [_worker start]; } - (void)main { [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timer_tick:) userInfo:nil repeats:YES]; [NSThread sleepForTimeInterval:INFINITY]; NSLog(@"**********************"); } - (void)timer_tick:(NSTimer*)timer { NSLog(@"%@", NSThread.currentThread); } The timer never gets fired. What's wrong with my code?
2
0
186
2w
ios 17.5.1 keyboard glitch on some batches on iphone 14+models(not all)
We are using Material Textfield iOS component (as directed by our client), https://github.com/material-components/material-components-ios/blob/develop/components/TextControls/README.md , after ios 17.5.1 update, for all the material textfield on some iphone 14+ models there is a keyboard appearance issue, the keyboard starts to appear but dismisses immediately on tap of any textfeild,i.e material textfield component, apple's uitextfield works properly, we have an iphone 14+ with ios 17.5.1, for us it works without any issues, our app was uploaded using xcode 14.2, not sure how to fix this issue as we are not able to reproduce it, couple of users have reported this issue, it however works on all other iphone models!!! Any help would be greatly appreciated , i understand this is a third party SDK, but how to simulate this bug, if it is happening only on some devices and on the same device models we have, are working.
1
0
292
21h
Mistake in OpenGLView:drawRect
I rewrite an old project since OpenGL is deprecated and the downgrade to High Sierra goes with the lost of the old project. Here is the drawRect: - (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; if(backgroundColor == 1) glClearColor(0.95f, 1.0, 1.0f, 1.0); else glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0 ,0.0, -10.0); // After mistake I wrote PushMatrix() glTranslatef(-0.01 ,-0.01, -10.0); // Screen Shot 0 // glTranslatef(-0.25 ,-0.25, -10.0); Screen Shot 1 glLineWidth(1.0); glRotated(rotationX, 1, 0, 0); glRotated(rotationY, 0, 1, 0); glCallList(axes); // After mistake I wrote PopMatrix() // Axes Vertices of xx,y,z are 1.0 // With vertices +/-0.99 nothing is drawn [self glError]; [self.openGLContext flushBuffer]; } I hope you Accept my Text and hope you can help me ! Mit freundlichen Grüßen Uwe Screen Shot 0 Screen Shot 1
1
0
212
1w
Passkey AutoFill won't show the "passkey" prompt above the native keyboard
We implemented passkeys Autofill feature in iOS 16.6. Later verified in iOS 17.0 as well. But when we upgraded to iOS 17.5, the available passkeys autofill prompt is disappeared now. No code changes were done from our side. Also upgraded to iOS 17.5.1 and checked, still doesn’t show the prompt on the keyboard. For autofill we are calling 'performAutoFillAssistedRequests()' API on our ASAuthorizationController after fetching assertion options response from our Relying-Party. Our textFields content type is set to ‘username’. Additional Info: Before making the performAutoFillAssistedRequests() API call, when we click on the ‘Passwords’ icon on keyboard, it only shows the passwords saved on iPhone. But after making the call, we can see available passkeys as well in the list. We are making the fetch assertion options response call on textField delegate after typing more than two characters. I already raised a bug in Feedback Assistant on this - FB13809196. I attached a video and sysdiag file there.
0
0
234
2w
debug dlopen returning NULL
Hi, For the very same plugin dlopen() sometimes fails. The library is present but sometimes it returns NULL and sometimes a valid plugin handle. Here is the code: char *filename; void *plugin_so; filename = "/Applications/com.example.MyApp/Contents/Plugins/myplugin.dylib"; plugin_so = dlopen(filename, RTLD_NOW); I have debugged using lldb checked filename and it is present. The myplugin.dylib file supports 2 architectures, arm64 and x86_64. regards, Joël
1
0
231
2w
nw_connection_t and STARTTLS for SMTP connections
I'm using Network to establish a connection to various SMTP servers. For SMTP servers that use SSL on port 465, using the following code to establish the connection and communicate with the server works fine (read/write code omitted): nw_endpoint_t endpoint = nw_endpoint_create_host("smtp.example.com", "465"); nw_parameters_t parameters = nw_parameters_create_secure_tcp(NW_PARAMETERS_DEFAULT_CONFIGURATION, NW_PARAMETERS_DEFAULT_CONFIGURATION); nw_connection_t connection = nw_connection_create(endpoint, parameters); nw_connection_set_queue(connection, dispatch_get_main_queue()); nw_connection_set_state_changed_handler(connection, ^(nw_connection_state_t state, nw_error_t error) { //... } nw_connection_start(connection); For servers on port 587 that require an insecure connection at start then renegotiate a TLS handshake with the STARTTLS command, I change the parameters like so: nw_parameters_t parameters = nw_parameters_create_secure_tcp(NW_PARAMETERS_DISABLE_PROTOCOL, NW_PARAMETERS_DEFAULT_CONFIGURATION); This does allow me to establish the connection to the SMTP server but I'm stumped on how to initiate TLS on the established connection after invoking the STARTTLS command and receiving an OK response from the SMTP server. How do I add TLS options to an existing connected nw_connection_t connection?
5
0
326
3w
How to use .a in swift with an empty header
I'm making a Swift Program. I got a .a file that builded from some c++ scripts,and I can see some fuctions in it by commed "nm *.a", and a .h file like this My question is how to call the fuctions in .a like "testDebug",I can call from c# like [DllImport("__Internal")] private static extern void testDebug(); Google's answer always with a right .h file,Maybe I should make .h file correct first. Any reply would be greatly appreciated.
2
0
190
3w
Can't establish mTLS on iOS with WKWebView and ProxyConfiguration
I have a sample iOS app in Xcode that I run in the iOS 17.5 Simulator. It creates a WKWebView and configures a proxy via the ProxyConfiguration API, it works as expected unless the proxy tries to establish mTLS. It seems there is no way to handle the client certificate request when using a proxy. If I navigate to a page that requests mTLS without a proxy configured, it works as expected. Here is a minimal repro: #import "ViewController.h" #import &lt;WebKit/WebKit.h&gt; @import Foundation; @import WebKit; @interface ViewController () &lt;WKNavigationDelegate&gt; @property (nonatomic,strong) WKWebView* webView; @property (nonatomic, strong) WKWebViewConfiguration * webConfig; @end @implementation ViewController - (void)loadView { [super loadView]; nw_protocol_options_t tls_options = nw_tls_create_options(); sec_protocol_options_t sec_options = nw_tls_copy_sec_protocol_options(tls_options); sec_protocol_options_set_challenge_block( sec_options, ^(sec_protocol_metadata_t metadata, sec_protocol_challenge_complete_t challenge_complete) { NSLog(@"Inside of challenge block"); challenge_complete(nil); }, dispatch_get_main_queue()); nw_endpoint_t proxy_endpoint = nw_endpoint_create_host(GetHost(), GetPort()); nw_relay_hop_t relay = nw_relay_hop_create(nil, proxy_endpoint, tls_options); nw_proxy_config_t proxy_config = nw_proxy_config_create_relay(relay, nil); nw_proxy_config_add_match_domain(proxy_config, "api.ipify.org"); self.webConfig = [[WKWebViewConfiguration alloc] init]; self.webConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore]; self.webConfig.websiteDataStore.proxyConfigurations = @[ proxy_config ]; self.webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:self.webConfig]; self.webView.navigationDelegate = self; [self.view addSubview:self.webView]; } - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"%s",__func__); NSURL* url = [[NSURL alloc] initWithString:@"https://api.ipify.org"]; NSURLRequest* request = [[NSURLRequest alloc] initWithURL:url]; [self.webView loadRequest:request]; } - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation { NSLog(@"%s",__func__); } - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error { NSLog(@"%s. Error %@",__func__,error); } - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential *))completionHandler { NSLog(@"%s",__func__); NSLog(@"protection space: %@", challenge.protectionSpace.authenticationMethod); completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); } @end The logs for this code show: -[ViewController viewDidLoad] -[ViewController webView:didStartProvisionalNavigation:] -[ViewController webView:didFailProvisionalNavigation:withError:]. Error Error Domain=NSURLErrorDomain Code=-1206 "The server “api.ipify.org” requires a client certificate." If we don't set up the ProxyConfiguration and navigate to a site that requires mTLS, the logs look like this: -[ViewController viewDidLoad] -[ViewController webView:didReceiveAuthenticationChallenge:completionHandler:] protection space: NSURLAuthenticationMethodServerTrust -[ViewController webView:didReceiveAuthenticationChallenge:completionHandler:] protection space: NSURLAuthenticationMethodClientCertificate -[ViewController webView:didStartProvisionalNavigation:] //... Eventually the request fails but the key difference is that didReceiveAuthenticationChallenge was invoked. When using the ProxyConfiguration neither that function nor the block we set via sec_protocol_options_set_challenge_block were run. I also tried to provide the client identity via sec_protocol_options_set_local_identity to no avail, and I've tried configuring these options too but they had no effect sec_protocol_options_add_tls_application_protocol(sec_options, "h2"); sec_protocol_options_set_max_tls_protocol_version(sec_options, tls_protocol_version_TLSv13); sec_protocol_options_set_peer_authentication_required(sec_options, true); Am I missing something? Or is this a bug in the ProxyConfiguration API?
0
1
307
3w
Unable to import ObjC interface from a package in a public ObjC file in a framework
Problem Statement: Unable to import .h file from an ObjC SPM to a .h file in an ObjC file in a framework with mix of ObjC and Swift code The issue is: in order to support access of ObjC file in Swift code in a framework we need to use umbrella header (in place of bridging header). Once the file is imported in Umbrella header and made public it will no longer allow import of .h file from package in its interface Project Structure: a. Package: ObjCPackage ObjCPackage |- Package.swift |- ObjCPackage MathsUtilities.h (class interface) MathsUtilities.m (class implementation) NiceLogs.h (protocol) b. Project: ObjCSwiftFramework ObjCSwiftFramework |- ObjCSwiftFramework.h (umbrella header) |- Calculation.h (objc class interface) |- Calculation.m (objc class implementation) |- SwiftCalci.swift (swift class) Details: #import <ObjCSwiftFramework/Calculation.h> added in ObjCSwiftFramework.h as Calculation has to be used in SwiftCalci Calculation.h marked as public in target membership in Xcode so that it can be added in umbrella header ObjCSwiftFramework.h #import "NiceLogs.h" in Calculation.h gives error Here is a small sample which I created to demonstrate the problem: ObjCSwiftFramework
0
0
184
May ’24
Mac app crashing in CF_IS_OBJC function on macOS Sonoma
I have an Electron app on macOS Sonoma (Intel arch). It has a native addon (app.node) using node-addon-api. Recently it crashed, with the stack trace (given below). What is the CF_IS_OBJC function inside the CFDataGetBytePtr function, and why did it crash there? [NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^(NSEvent *event) { // code using CFDataGetBytePtr function }]; [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyDown handler:^NSEvent *_Nullable(NSEvent *event) { // code using CFDataGetBytePtr function return event; }]; I have key events monitors attached using addGlobalMonitorForEventsMatchingMask and addLocalMonitorForEventsMatchingMask in my native code and they use the CFDataGetBytePtr function there. So I think the issue happened in the key event monitor handler when calling the CFDataGetBytePtr function because my native addon app.node is also present in the trace. Also from the third and fourth entry in the stack trace, it seems like it happened while the app was updating. OS Version: macOS 14.4 (23E214) Report Version: 104 Crashed Thread: 5490 Application Specific Information: Fatal Error: EXC_BAD_ACCESS / KERN_INVALID_ADDRESS / 0x0 Thread 5490 Crashed: 0 CoreFoundation 0x19c970118 CF_IS_OBJC 1 CoreFoundation 0x19c83b280 CFDataGetBytePtr 2 .app.desktop.1inmRz 0x104a5bec0 &lt;unknown&gt; 3 .app.desktop.1inmRz 0x104a57b28 &lt;unknown&gt; 4 app.node 0x104a80a7c [inlined] Napi::details::CallbackData&lt;T&gt;::Wrapper::lambda::operator() (napi-inl.h:117) 5 app.node 0x104a80a7c Napi::details::WrapCallback&lt;T&gt; (napi-inl.h:79) 6 app.node 0x104a80a24 Napi::details::CallbackData&lt;T&gt;::Wrapper (napi-inl.h:112) 7 Electron Framework 0x11472e5e0 v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke (js_native_api_v8.cc:441) 8 &lt;unknown&gt; 0x147e105f8 &lt;unknown&gt; 9 &lt;unknown&gt; 0x1401d0814 &lt;unknown&gt; 10 &lt;unknown&gt; 0x1401d0a9c &lt;unknown&gt; 11 &lt;unknown&gt; 0x147f19368 &lt;unknown&gt; 12 &lt;unknown&gt; 0x147e0aab0 &lt;unknown&gt; 13 &lt;unknown&gt; 0x1401d0e00 &lt;unknown&gt; 14 &lt;unknown&gt; 0x1401d1ac0 &lt;unknown&gt; 15 &lt;unknown&gt; 0x147f19368 &lt;unknown&gt; 16 &lt;unknown&gt; 0x147e0aab0 &lt;unknown&gt; 17 &lt;unknown&gt; 0x1401d1494 &lt;unknown&gt; 18 &lt;unknown&gt; 0x1401d20dc &lt;unknown&gt; 19 &lt;unknown&gt; 0x147e4c1b4 &lt;unknown&gt; 20 &lt;unknown&gt; 0x147f1b5f8 &lt;unknown&gt; 21 &lt;unknown&gt; 0x147e3b754 &lt;unknown&gt; 22 &lt;unknown&gt; 0x147e0b618 &lt;unknown&gt; 23 Electron Framework 0x10ee0c49c v8::internal::(anonymous namespace)::Invoke (simulator.h:178) 24 Electron Framework 0x10ee0d08c v8::internal::(anonymous namespace)::InvokeWithTryCatch (execution.cc:475) 25 Electron Framework 0x10ee0d1e0 v8::internal::Execution::TryRunMicrotasks (execution.cc:576) 26 Electron Framework 0x10ee37364 v8::internal::MicrotaskQueue::PerformCheckpoint (microtask-queue.cc:176) 27 Electron Framework 0x1146cce9c node::InternalCallbackScope::Close (callback.cc:137) 28 Electron Framework 0x1146ccb64 node::InternalCallbackScope::~InternalCallbackScope (callback.cc:92) 29 Electron Framework 0x1147112b4 node::Environment::RunTimers (env.cc:1376) 30 Electron Framework 0x10daf9980 uv__run_timers (timer.c:178) 31 Electron Framework 0x10dafcb3c uv_run (core.c:465) 32 Electron Framework 0x10dc944d4 electron::NodeBindings::UvRunOnce (node_bindings.cc:891) 33 Electron Framework 0x110e2016c base::TaskAnnotator::RunTaskImpl (callback.h:156) 34 Electron Framework 0x110e3cea4 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork (task_annotator.h:89) 35 Electron Framework 0x110e8851c base::MessagePumpCFRunLoopBase::RunWorkSource (message_pump_apple.mm:444) 36 Electron Framework 0x10da7ad7c base::apple::CallWithEHFrame 37 Electron Framework 0x110e876a4 base::MessagePumpCFRunLoopBase::RunWorkSource (message_pump_apple.mm:415) 38 CoreFoundation 0x19c89deac __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 39 CoreFoundation 0x19c89de40 __CFRunLoopDoSource0 40 CoreFoundation 0x19c89dbb0 __CFRunLoopDoSources0 41 CoreFoundation 0x19c89c79c __CFRunLoopRun 42 CoreFoundation 0x19c89be08 CFRunLoopRunSpecific 43 HIToolbox 0x1a7036ffc RunCurrentEventLoopInMode 44 HIToolbox 0x1a7036e38 ReceiveNextEventCommon 45 HIToolbox 0x1a7036b90 _BlockUntilNextEventMatchingListInModeWithFilter 46 AppKit 0x1a00f496c _DPSNextEvent 47 AppKit 0x1a08e6de8 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 48 AppKit 0x1a00e7cb4 -[NSApplication run] 49 Electron Framework 0x110e89244 base::MessagePumpNSApplication::DoRun (message_pump_apple.mm:805) 50 Electron Framework 0x110e87068 base::MessagePumpCFRunLoopBase::Run (message_pump_apple.mm:156) 51 Electron Framework 0x110e3d9a0 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run (thread_controller_with_message_pump_impl.cc:646) 52 Electron Framework 0x110e05a98 base::RunLoop::Run (run_loop.cc:134) 53 Electron Framework 0x10ffcbcd0 content::BrowserMainLoop::RunMainMessageLoop (browser_main_loop.cc:1094) 54 Electron Framework 0x10ffcd744 content::BrowserMainRunnerImpl::Run (browser_main_runner_impl.cc:158) 55 Electron Framework 0x10ffc964c content::BrowserMain (browser_main.cc:34) 56 Electron Framework 0x10de12aa8 content::RunBrowserProcessMain (content_main_runner_impl.cc:712) 57 Electron Framework 0x10de13b1c content::ContentMainRunnerImpl::RunBrowser (content_main_runner_impl.cc:1299) ...
7
1
347
May ’24
Crash in CoreGraphics
My app is crashing in CoreGraphics. As per the observations, it started crashing for Mac OS 14.4 and 14.4.1 on Arm machines. It is observed on multiple machines. Can someone please help on this? Following is the backtrace: Process: MyApp [1300] Path: /Applications/MyApp.app/Contents/MacOS/MyApp Identifier: com.MyCompany.MyApp Version: 7.2.3 (???) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 502 Date/Time: 2024-04-23 20:48:08.7647 +0530 OS Version: macOS 14.4.1 (23E224) Report Version: 12 Anonymous UUID: 6DAE9C94-37AC-96D0-7221-3AAA99D9E5F6 Sleep/Wake UUID: 03812728-62F0-45A4-86FC-07E151462C11 Time Awake Since Boot: 11000 seconds Time Since Wake: 1385 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000008 Exception Codes: 0x0000000000000001, 0x0000000000000008 Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [1300] VM Region Info: 0x8 is not in any region. Bytes before following region: 4338843640 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---&gt; __TEXT 1029d8000-1029e4000 [ 48K] r-x/r-x SM=COW /Applications/MyApp.app/Contents/MacOS/MyApp Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 CoreGraphics 0x186aabdac shape_union + 656 1 CoreGraphics 0x186aababc shape_union_with_bounds + 128 2 CoreGraphics 0x186aab9f4 CGRegionCreateUnionWithRect + 240 3 AppKit 0x184b439dc 0x18473e000 + 4217308 4 AppKit 0x184b2ad4c 0x18473e000 + 4115788 5 AppKit 0x184dc358c -[NSViewBackingLayer setNeedsDisplayInRect:] + 176 6 AppKit 0x184790874 -[NSView setNeedsDisplayInRect:] + 396 7 Foundation 0x182070914 __NSThreadPerformPerform + 264 8 CoreFoundation 0x180f21eb0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 9 CoreFoundation 0x180f21e44 __CFRunLoopDoSource0 + 176 10 CoreFoundation 0x180f21bb4 __CFRunLoopDoSources0 + 244 11 CoreFoundation 0x180f207a0 __CFRunLoopRun + 828 12 CoreFoundation 0x180f1fe0c CFRunLoopRunSpecific + 608 13 HIToolbox 0x18b6bb000 RunCurrentEventLoopInMode + 292 14 HIToolbox 0x18b6bae3c ReceiveNextEventCommon + 648 15 HIToolbox 0x18b6bab94 _BlockUntilNextEventMatchingListInModeWithFilter + 76 16 AppKit 0x184778970 _DPSNextEvent + 660 17 AppKit 0x184f6adec -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700 18 AppKit 0x18476bcb8 -[NSApplication run] + 476 19 libffi.dylib 0x191df8050 ffi_call_SYSV + 80 20 libffi.dylib 0x191e00ae0 ffi_call_int + 1212 21 _objc.cpython-39-darwin.so 0x10700a47c PyObjCFFI_Caller_SimpleSEL + 1204 22 _objc.cpython-39-darwin.so 0x107034e94 objcsel_vectorcall_simple + 768 23 Python 0x104312ddc call_function + 124 24 Python 0x104311ac0 _PyEval_EvalFrameDefault + 29288 25 Python 0x10427a720 _PyFunction_Vectorcall + 628 26 Python 0x104312ddc call_function + 124 27 Python 0x104311ac0 _PyEval_EvalFrameDefault + 29288 28 Python 0x10427a57c _PyFunction_Vectorcall + 208 29 Python 0x104312ddc call_function + 124 30 Python 0x104311a4c _PyEval_EvalFrameDefault + 29172 31 Python 0x10427a57c _PyFunction_Vectorcall + 208 32 Python 0x104312ddc call_function + 124 33 Python 0x104311ac0 _PyEval_EvalFrameDefault + 29288 34 Python 0x10427a57c _PyFunction_Vectorcall + 208 35 Python 0x104312ddc call_function + 124 36 Python 0x104311aec _PyEval_EvalFrameDefault + 29332 37 Python 0x10427a57c _PyFunction_Vectorcall + 208 38 Python 0x104312ddc call_function + 124 39 Python 0x104311aec _PyEval_EvalFrameDefault + 29332 40 Python 0x1043131a0 _PyEval_EvalCode + 620 41 Python 0x10430a7d0 PyEval_EvalCode + 80 42 MyApp 0x1029dd440 0x1029d8000 + 21568 43 MyApp 0x1029dd7c0 0x1029d8000 + 22464 44 dyld 0x180aba0e0 start + 2360
2
0
314
May ’24
Simulating a signal
Hello, I'm trying to simulate miscellaneous crashes to test my handlers. Things works as expected with NSException and C++ exceptions, however I cannot find a way to trig a C signal. I tried with this code: NSArray *runningApplications = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.myCompany.myApp"]; NSRunningApplication *app = runningApplications[0]; UInt32 pid = [app processIdentifier]; kill(pid, SIGABRT); It is caught by my handler, but it doesn't crash the app (although it's detached from the debugger), I can even continue using the app normally. I'm wondering if this could be related to something wrong in my handler (especially on how it ends): signal(sig, SIG_IGN); dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, sig, 0, dispatch_get_global_queue(0, 0)); dispatch_source_set_event_handler(source, ^{ // I write some logs on disk here, then uninstall the handlers associated with this or that signal: for(int i=0; i<SignalSourceCount; i++) { if (_signalSources[i]) { dispatch_source_cancel(_signalSources[i]); _signalSources[i] = NULL; } } }); dispatch_resume(source); I've seen some examples finishing rather with exit() or abort(). Abort crashes the app as expected, however the Crash Report produced by Apple then focuses on the handler instead of the code triggering the signal... Any help appreciated, thanks
4
0
333
May ’24