Objective-C

RSS for tag

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

Posts under Objective-C tag

214 Posts
Sort by:
Post not yet marked as solved
1 Replies
365 Views
Im honestly a bit lost and looking for general pointers. Here is the general flow of my project. I have an Xcode project where I want to return and convert the temperature values accessed from the apple smc and I found a GitHub repo with all the smc key sensors for the M3Pros/Max chips: https://github.com/exelban/stats/issues/1703 basically, I have all these keys stored in an array in obj-c like so: NSArray *smcKeys = @[ @"Tp01", @"Tp05", @"Tp09", @"Tp0D", @"Tp0b", @"Tp0f", @"Tp0j", @"Tp0n",@"Tp0h", @"Tp0L", @"Tp0S", @"Tp0V", @"Tp0z", @"Tp0v", @"Tp17", @"Tp1F", @"Tp1J", @"Tp1p", @"Tp1h", @"Tp1R", ]; I am passing all these keys by passing 'smcKeys' in a regular C code file I have here that is meant to open, close and read the data shown here: #include "smc.h" #include <mach/mach.h> #include <IOKit/IOKitLib.h> #include "smckeys.h" io_connect_t conn; kern_return_t openSMC(void) { kern_return_t result; kern_return_t service; io_iterator_t iterator; service = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching("AppleSMC"), &iterator); if(service == 0) { printf("error: could not match dictionary"); return 0; } result = IOServiceOpen(service, mach_task_self(), 0, &conn); IOObjectRelease(service); return 0; } kern_return_t closeSMC(void) { return IOServiceClose(conn); } kern_return_t readSMC(char *smcKeys, SMCVal_t *val) { kern_return_t result; uint32_t keyCode = *(uint32_t *)smcKeys; SMCVal_t inputStruct; SMCVal_t outputStruct; inputStruct.datasize = sizeof(SMCVal_t); inputStruct.datatype = 'I' << 24; //a left shift operation. turning the I into an int by shifting the ASCII value 24 bits to the left inputStruct.data[0] = keyCode; result = IOConnectCallStructMethod(conn, 5, &inputStruct, sizeof(SMCVal_t), &outputStruct, (size_t*)&inputStruct.datasize); if (result == kIOReturnSuccess) { if (val -> datasize > 0) { if (val -> datatype == ('f' << 24 | 'l' << 16 | 't' << 8 )) { //bit shifting to from 32bit operation associated with the ASCII charecters'f', 'l', and 't', sets datatype field. double temp = *(double *)val -> data; return temp; } } } return 0.0; } Which I am then then calling the functions from this file in a swift file and converting the values to Fahrenheit but no data is being printed in my console: import IOKit public class getTemperature { public struct SMCVal_t { var datasize: UInt32 var datatype: UInt32 var data: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) } @_silgen_name("openSMC") func openSMC() -> kern_return_t @_silgen_name("closeSMC") func closeSMC() -> kern_return_t @_silgen_name("readSMC") func readSMC(key: UnsafePointer<CChar>?,val: UnsafeMutablePointer<SMCVal_t>) -> kern_return_t func convertAndPrintTempValue(key:UnsafePointer<CChar>?,scale: Character, showTemp: Bool ) -> kern_return_t { let openSM = openSMC() guard openSM == 0 else { print("Failed to open SMC: \(openSM)") return kern_return_t() } let closeSM = closeSMC() guard closeSM == 0 else { print("could not close SMC: \(closeSM)") return IOServiceClose(conn) } func convertAndPrint(val: SMCVal_t) -> Double { if val.datatype == (UInt32("f".utf8.first!) << 24 | UInt32("l".utf8.first!) << 16 | UInt32("t".utf8.first!) << 8) { let extractedTemp = Double(val.data.0) return( extractedTemp * 9.0 / 5.0 + 32.0 ) } return 0.0 } let smcValue = SMCVal_t(datasize: 0, datatype: 0, data: (0,0,0,0,0,0,0,0)) let convertedVal = convertAndPrint(val: smcValue) print("Temperarure:\(convertedVal)F°") return kern_return_t() } } I know this is a lot but I am honestly looking for any tips to fill in any gaps in my knowledge for anyone who's built a similar application meant to extract any sort of data from Mac hardware.
Posted
by Aor1105.
Last updated
.
Post not yet marked as solved
1 Replies
357 Views
I have a sandboxed app in /Applications. I'm attempting to shoot a problem with LLDB, so I cd to /Applications/app-name/Contents/MacOS and do lldb programname. However, once I fire it off with "r" it dies instantly with: error: process exited with status -1 (lost connection) Should this work? Should I try signing the lldb executable? Thanks!
Posted Last updated
.
Post not yet marked as solved
2 Replies
388 Views
Because my MacOS app has a user-programmable interface, my coding creates lots of interface elements programmatically. Soon after an update to MacOS 14.3.1, I found some of these element (NSTextFields) did not draw correctly. I had not changed any code but the appearance changed for the worse (the text in the text field did not appear). I then noticed: The problem occurs when I compile in XCode 15.2 (15C500b) Version and run on computer with Sonoma 14.3.1 (23D60) If I instead compile in XCode Version 14.1 (14B47b) on Ventura 13.0.1 (22A400) and copy the app to my computer with Sonoma 14.3.1 (23D60)all works as expected. These results seem to imply XCode 15.2 does not compile correctly? Is this known issue or is there a fix?
Posted Last updated
.
Post not yet marked as solved
0 Replies
274 Views
Hi there, i have an macOS app, sandboxed, compatibility 10.13 up to Sonoma, objective-C. I have a dropzone (or alternatively selection with NSOpenPanel) where users can drop files which results in an array of NSURLs. I create bookmarks to securely access them. This worked for years. Now i want to add iCloud support. Everything works good so far. I have methods to check the file status and download the file from icloud if NSURLUbiquitousItemDownloadingStatusKey == NSURLUbiquitousItemDownloadingStatusNotDownloaded Then i listen for the file, once the status key changes to NSURLUbiquitousItemDownloadingStatusCurrent i continue with processing the NSURL and i want to create bookmarkData: [filePathUrl bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope includingResourceValuesForKeys:nil relativeToURL:nil error:&amp;error]]; But this returns the error "Could not open() the item: [1: Operation not permitted]" So i was wondering if downloading the file from iCloud now changed the NSURL itself so the given permissions by dropping do not match the downloaded file? Adding [filePathUrl startAccessingSecurityScopedResource]; didn't change anything. Any help appreciated
Posted
by patMorita.
Last updated
.
Post not yet marked as solved
1 Replies
282 Views
I have multiple mobile applications, one developed in React Native and the other in Objective-C and Swift hybrid technology. I use my own system to send push notifications, and these notifications are left encrypted in the Apple queues. However, in any of my applications, I am unable to catch these messages in the code block where I decrypt them. As a result, users see the messages encrypted. While I can deterministically detect this issue on devices experiencing the offload feature from Apple, I've also noticed sporadic occurrences of this issue on devices not utilizing offload. Due to my security policies, I have no chance of sending messages unencrypted. I'm trying to understand why this is happening and need suggestions for a solution. Is there anyone who can help? Additional Information: I use my own system for push notifications. Messages are left encrypted in the Apple queues. I am unable to catch the messages in the code block where I decrypt them in one of the applications. I can deterministically detect the issue on devices experiencing the offload feature. I've noticed sporadic occurrences of this issue on devices not using offload. Due to security policies, I have no chance of sending messages unencrypted. I tried sending without offloading, and the messages arrived unencrypted I searched for a callback handler function on the Apple side - couldn't find one. To ensure notifications were sent correctly, I performed token checks in my database.
Posted Last updated
.
Post not yet marked as solved
0 Replies
353 Views
I have an Xcode project with an obj-c .c file and a .h file aswell as a .swift file where I am calling functions from those obj-c files with a bridging header but when I build my project I get a duplicate symbols error and Xcode doesn't show where. here is .h header file: #define smc_h #include &lt;stdint.h&gt; #include &lt;mach/mach.h&gt; #include &lt;IOKit/IOKitLib.h&gt; typedef struct { uint32_t datasize; uint32_t datatype; uint8_t data[8]; } SMCVal_t; io_connect_t conn; kern_return_t openSMC(void); kern_return_t closeSMC(void); kern_return_t readSMC(char *key, SMCVal_t *val); double convertToFahrenheit(SMCVal_t *val); #endif /* smc_h */ my .c implementation file: #include "smc.h" kern_return_t openSMC(void) { kern_return_t result; kern_return_t service; io_iterator_t iterator; service = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching("AppleSMC"), &amp;iterator); if(service == 0) { printf("error: could not match dictionary"); return 0; } result = IOServiceOpen(service, mach_task_self(), 0, &amp;conn); IOObjectRelease(service); return 0; } kern_return_t closeSMC(void) { return IOServiceClose(conn); } kern_return_t readSMC(char *key, SMCVal_t *val) { kern_return_t result; uint32_t keyCode = *(uint32_t *)key; SMCVal_t inputStruct; SMCVal_t outputStruct; inputStruct.datasize = sizeof(SMCVal_t); inputStruct.datatype = 'I' &lt;&lt; 24; //a left shift operation. turning the I into an int by shifting the ASCII value 24 bits to the left inputStruct.data[0] = keyCode; result = IOConnectCallStructMethod(conn, 5, &amp;inputStruct, sizeof(SMCVal_t), &amp;outputStruct, (size_t*)&amp;inputStruct.datasize); if (result == kIOReturnSuccess) { if (val -&gt; datasize &gt; 0) { if (val -&gt; datatype == ('f' &lt;&lt; 24 | 'l' &lt;&lt; 16 | 't' &lt;&lt; 8 )) { //bit shifting to from 32bit operation associated with the ASCII charecters'f', 'l', and 't', sets datatype field. double temp = *(double *)val -&gt; data; return temp; } } } return 0.0; } double convertToFahrenheit(SMCVal_t *val) { if(val -&gt; datatype == ('f' &lt;&lt; 24 | 'l' &lt;&lt; 16 | 't' &lt;&lt; 8 )) { //checking if val-&gt;datatype is equal to the result of the bit-shifting operation. double temp = *(double *)val -&gt; data; return (temp * 9.0 / 5.0) + 32.0; } return 0.0; } And my .swift file where my objc functions are called: import IOKit public class CPUTempCaller { public struct SMCVal_t { var datasize: UInt32 var datatype: UInt32 var data: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) } @_silgen_name("openSMC") func openSMC() -&gt; Int32 @_silgen_name("closeSMC") func closeSMC() -&gt; Int32 @_silgen_name("readSMC") func readSMC(key: UnsafePointer&lt;CChar&gt;?,val: UnsafeMutablePointer&lt;SMCVal_t&gt;) -&gt; kern_return_t @_silgen_name("convertToFahrenheit") func convertToFahrenheit(val: UnsafePointer&lt;SMCVal_t&gt;) -&gt; Double { let openSM = openSMC() guard openSM == 0 else { print("Failed to open SMC: \(openSM)") return 0.0; } let closeSM = closeSMC() guard closeSM == 0 else { print("could not close SMC: \(closeSM)") return 0.0; } func convertAndPrintTempValue(key:UnsafePointer&lt;CChar&gt;?,scale: Character, showTemp: Bool ) -&gt; Double? { var SMCValue = SMCVal_t(datasize: 0, datatype: 0, data:(0,0,0,0,0,0,0,0)) //initializing SMC value if let Key = key { //check if nil. If not nil, proceed to code block execution let key = "TC0P" let keyCString = (key as NSString).utf8String //passing key as null terminated utf8 string let readSMCResult = readSMC(key: keyCString, val: &amp;SMCValue) //call readSMC obj-C function, store result in "readSMCResult" if readSMCResult != KERN_SUCCESS { print("Failed to read SMC: \(readSMCResult)") } } if showTemp { //return nil if showTemp is false let convertRawToFahrenheit = convertToFahrenheit(val: &amp;SMCValue) let scaleToStr = String(scale) print(String(format: "Temperature: %0.1f °%c", convertRawToFahrenheit, scaleToStr)) return nil } else { print("could not convert temperature and format values in Fahrenheit") return nil } } return 0.0; } }
Posted
by Aor1105.
Last updated
.
Post not yet marked as solved
1 Replies
305 Views
Hi, i have a daemon service written in Objective-C and C++. i need to detect user change events and reboot my service. I'm using SCDynamicStoreKeyCreateConsoleUser and get notifications for user switch events but not for fast user switch events. is there a way to reliably subscribe to all kinds of user switch events including VNC connection?
Posted
by alzix.
Last updated
.
Post not yet marked as solved
1 Replies
351 Views
I have a swift file where I am calling objective c functions and providing pointers to certain values where needed but im getting the error " : Cannot convert value of type 'Swift.UnsafeMutablePointer<MacStat.SMCVal_t>' to expected argument type 'Swift.UnsafeMutablePointer<__ObjC.SMCVal_t>' " Here is the relevant code block where I am getting the error: var convertRawToFahrenheit: Double = 0.0 withUnsafeMutablePointer(to: &SMCValue) { pointer in convertRawToFahrenheit = convertToFahrenheit(val: pointer) } print(String(format: "Temperature: %0.1f °%c", convertRawToFahrenheit )) return nil } else { print("could not convert temperature and format values in Fahrenheit") return nil } return 0.0; } I already have a bridging header and the path to that header set up so I know the issue Isn't anything that involves my C functions not getting recognized in swift. I will also provide my full code: import IOKit public struct SMCVal_t { var datasize: UInt32 var datatype: UInt32 var data: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) } @_silgen_name("openSMC") func openSMC() -> Int32 @_silgen_name("closeSMC") func closeSMC() -> Int32 @_silgen_name("readSMC") func readSMC(key: UnsafePointer<CChar>?,val: UnsafeMutablePointer<SMCVal_t>) -> kern_return_t func convertAndPrintTempValue(key:UnsafePointer<CChar>?,scale: Character, showTemp: Bool ) -> Double? { let openSM = openSMC() guard openSM == 0 else { print("Failed to open SMC: \(openSM)") return 0.0; } let closeSM = closeSMC() guard closeSM == 0 else { print("could not close SMC: \(closeSM)") return 0.0; } var SMCValue = SMCVal_t(datasize: 0, datatype: 0, data:(0,0,0,0,0,0,0,0)) //initializing SMC value if let key = key { //check if nil. If not nil, proceed to code block execution let key = "TC0P" let keyCString = (key as NSString).utf8String //passing key as null terminated utf8 string let readSMCResult = readSMC(key: keyCString, val: &SMCValue) //call readSMC obj-C function, store result in "readSMCResult" if readSMCResult != KERN_SUCCESS { print("Failed to read SMC: \(readSMCResult)") } } if showTemp { //return nil if showTemp is false var convertRawToFahrenheit: Double = 0.0 withUnsafeMutablePointer(to: &SMCValue) { pointer in convertRawToFahrenheit = convertToFahrenheit(val: pointer) } print(String(format: "Temperature: %0.1f °%c", convertRawToFahrenheit )) return nil } else { print("could not convert temperature and format values in Fahrenheit") return nil } return 0.0; }
Posted
by Aor1105.
Last updated
.
Post not yet marked as solved
1 Replies
391 Views
I am working on an app in Objective C. I added the the StoreKit framework with the logic using swift. everything worked as planned except for when I wanted to access properties and methods from my ObjC ViewController in the swift code. I did everything as is directed in the apple developer documentation, except it didn't work. I kept receiving the following errors; failed to emit precompiled bridging header ViewController.h file not found ( for the import code in the bridging header) I spent a whole day perusing the internet for a solution. Unfortunately, nothing worked. I thought I should try to import other classes from the ObjC into the bridging header. When I imported 3 files the 3rd one took after commenting out the 2 above it. Then I imported the ViewController again and the build was successful. I deleted every imported file above the file that I need to make visible to the swift compiler leaving the empty lines above it. Apparently, I was getting the errors because my import code was on line 4 instead of line 9, although the file is completely empty except for the comments created by Xcode when the file was automatically created. I am not sure why the placement of the line of code holds that much weight when the file is empty? **Can anyone explain to me any technicality that would lead to this issue? **
Posted
by MHErez.
Last updated
.
Post not yet marked as solved
1 Replies
534 Views
I have an Xcode project that include a .c file and .h header file. I am getting a duplicate symbol error and I cannot pinpoint what part of my code is the issue or maybe if it's a configuration issue in my Xcode settings or not. Here's my .h header file code with my declarations: #define smc_h #include <stdint.h> #include <mach/mach.h> #include <IOKit/IOKitLib.h> typedef struct { uint32_t datasize; uint32_t datatype; uint8_t data[8]; } SMCVal_t; extern io_connect_t conn; kern_return_t openSMC(void); kern_return_t closeSMC(void); kern_return_t readSMC(char *key, SMCVal_t *val); double convertToFahrenheit(SMCVal_t *val); #endif /* smc_h */ And here is my .c implementation: #include "smc.h" #include <mach/mach.h> #include <IOKit/IOKitLib.h> io_connect_t conn; kern_return_t openSMC(void) { kern_return_t result; kern_return_t service; io_iterator_t iterator; service = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceMatching("AppleSMC"), &iterator); if(service == 0) { printf("error: could not match dictionary"); return 0; } result = IOServiceOpen(service, mach_task_self(), 0, &conn); IOObjectRelease(service); return 0; } kern_return_t closeSMC(void) { return IOServiceClose(conn); } kern_return_t readSMC(char *key, SMCVal_t *val) { kern_return_t result; uint32_t keyCode = *(uint32_t *)key; SMCVal_t inputStruct; SMCVal_t outputStruct; inputStruct.datasize = sizeof(SMCVal_t); inputStruct.datatype = 'I' << 24; //a left shift operation. turning the I into an int by shifting the ASCII value 24 bits to the left inputStruct.data[0] = keyCode; result = IOConnectCallStructMethod(conn, 5, &inputStruct, sizeof(SMCVal_t), &outputStruct, (size_t*)&inputStruct.datasize); if (result == kIOReturnSuccess) { if (val -> datasize > 0) { if (val -> datatype == ('f' << 24 | 'l' << 16 | 't' << 8 )) { //bit shifting to from 32bit operation associated with the ASCII charecters'f', 'l', and 't', sets datatype field. double temp = *(double *)val -> data; return temp; } } } return 0.0; } double convertToFahrenheit(SMCVal_t *val) { if(val -> datatype == ('f' << 24 | 'l' << 16 | 't' << 8 )) { //checking if val->datatype is equal to the result of the bit-shifting operation. double temp = *(double *)val -> data; return (temp * 9.0 / 5.0) + 32.0; } return 0.0; }
Posted
by Aor1105.
Last updated
.
Post marked as solved
3 Replies
383 Views
I have a CoreData entity with a transformable property data that stores an NSDictionary. All of the classes inside the dictionary conform to NSSecureCoding I have been getting many instances of this warning : 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release In trying to clean up the warning and future-proof my app, but I am running into a lot of trouble. My understanding is that using NSKeyedUnarchiveFromData as the transformer in my data properties attribute should work, since the top level class is a dictionary and all of the contents conform to NSSecureCoding. However, my data dictionary is now coming back as NSConcreteMutableData so I cannot access the data in it. I have also tried creating a custom value transformer with additional allowedTopLevelClasses, but that hasn't helped, and again, the topLevel type is an NSDictionary, which should be allowed. Thank you for any guidance.
Posted
by benkamen.
Last updated
.
Post marked as solved
2 Replies
362 Views
My Xcode project has a c file, a swift file, and a .h header file with my declarations but when I build my xcdc project I get all these unknown type errors that occur specifically in my .h file. I also get the error "failed to emit precompiled header" error in my Bridging-header-h file:
Posted
by Aor1105.
Last updated
.
Post not yet marked as solved
1 Replies
317 Views
I am new to Objective C and relatively new to iOS development. I have an AVCaptureDevice object at hand and would like to print the maximum supported photo dimensions as provided by activeFormat.supportedMaxPhotoDimensions, using Objective C. I tried the following: for (NSValue *obj in device.activeFormat.supportedMaxPhotoDimensions) { CMVideoDimensions *vd = (__bridge CMVideoDimensions *)obj; NSString *s = [NSString stringWithFormat:@"res=%d:%d", vd->width, vd->height]; //print that string } If I run this code, I get: res=314830880:24994 This is way too high, and there is obviously something I am doing wrong, but I don't know what it could be. According to the information I see on the developer forum, I should get something closer to 4000:3000. I can successfully read device.activeFormat.videoFieldOfView and other fields, so I believe my code is sound overall.
Posted Last updated
.
Post not yet marked as solved
0 Replies
337 Views
This is a problem that only exists on MacOS 13 (Ventura) and MacOS 14 (Sonoma). On all earlier versions of MacOS, the existing code works well, and has for many years. I am working on an long-running Objective-C MacOS app (non-sandboxed) that uses WKWebView to display a static web page within a "pane" of a larger NSView. By "pane", I mean the WKWebView might be the only view within the encompassing NSView (thereby occupying all of its space), or it might occupy only one rectangle within it, if the NSView is divided into arbitrary rectangles. (Whether or not the WKWebView takes up the entire surrounding rectangle, or just a section of it, seems irrelevant.) The WKWebView is created offscreen at startup time, and later may become visible under user control. I don't need the displayed web page to permit any interactivity with the user other than scrolling, and I disable Javascript on the page using the WKWebViewConfiguration - which appears to work as intended. I therefore have no need for NSTrackingArea either, and am not using it. It does appear that the WKWebView has one NSTrackingArea by default, but it's not mine. I can remove it programmatically, but that does not appear to make any difference. When the WKWebView is visible, the app will instantly crash as soon as the cursor enters its rectangle. The stack trace shows the error: [_NSTrackingAreaCGViewHelper cursorAreas]: unrecognized selector sent to instance The problem here is that the _NSTrackingAreaCGViewHelper method appears to be something within an Apple internal framework - I can't find discussion of it anywhere on the Internet, or in Apple's developer docs. Same for the selector "cursorAreas" - I can't find any information about it at all. So this is starting to feel like a bug somewhere in Apple's internal framework. I can't understand why it's crashing with a message related to NSTrackingArea (or similar objects), when I'm not using tracking at all, but the "unrecognized selector" error is even more disturbing - I'm not calling the method, and certainly can't control the selector. I can't be sure, but this feels like Apple's error. I'd like to know if there might be a way for me to configure WKWebView to not use tracking at all, thereby eliminating the issue entirely, but I can't find a way to do that other than removing the NSTrackingAreas from the WKWebView, but that's not helping either. Can anyone (especially from Apple) offer any guidance? If it's an Apple bug, I would love to know how to work around it - it's a show-stopper for this app. Thanks in advance...
Posted
by hsoroka.
Last updated
.
Post not yet marked as solved
0 Replies
455 Views
I have a tvOS project contains an App target and 3 static libraries: EntryPoint – Static library that contains main , AppDelegate and SceneDelegate Experience – Static library containing my UI elements AppTarget – executable built using above two libraries I have a class "SelectionTable" which subclasses UITableView in Experience target : import UIKit class SelectionTable : UITableView { private var vDataSrc:[String]! func SetDataSrc (_ pDataSrc:[String]) { self.vDataSrc = pDataSrc } func UpdateDataSrc (_ pStringList:[String]) { self.vDataSrc += pStringList } func GetDataSrc () -> [String] { return self.vDataSrc } } I am not using this class anywhere and still i am getting these errors when i build my AppTarget: Cannot find interface declaration for 'UITableView', superclass of 'SelectionTable' Expected a type These above error are coming in generated header file "Experience-Swift.h". This file is auto-generated by compiler. I am not using @objc anywhere in the code, But still the Target-Swift.h file has the below lines: SWIFT_CLASS("_TtC10Experience22SelectionTable") @interface SelectionTable : UITableView - (nonnull instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER; @end When i am marking above class as Private , this error goes away . And also , if i am defining SelectionTable class in EntryPoint library , this error does not occur . I am using similar model for an iOS project also and there i am not facing this issue. I am using :- Swift version : Swift 5.9.2 XCode version : 15.2
Posted Last updated
.
Post marked as solved
2 Replies
277 Views
I had a customer feedback about a "zero length data" error which was captured using an exception handler and displayed using NSAlert. My app employs [NSURLSession dataTaskWithURL:] to download XML and image data. But I got no idea what it is about. I assume it's related to NSData, but this error never happened before (for years). Does anyone have any idea about the source of this error?
Posted
by imneo.
Last updated
.
Post not yet marked as solved
2 Replies
358 Views
We are getting many crash reports from users that just updated to Sonoma 14.3 on arm64 macs. We can reproduce these types of crashes on arm64 14.3 machines only (not Intel 14.3, other versions of macOS, etc). A typical crash report: Code Type: arm64 Parent Process: launchd [1] Date/Time: 2024-01-27T15:51:54.999Z Launch Time: 2024-01-27T15:51:43Z OS Version: Mac OS X 14.3.0 (23D56) Report Version: 104 Exception Type: SIGILL Exception Codes: ILL_NOOP at 0x2e23fc03 Crashed Thread: 9 Thread 9 Crashed: 0 QuartzCore 0x0000000188923428 CA::OGL::PathRenderer::PathRenderer(CA::OGL::Context&, CA::Mat2 const&, CA::Bounds const&, bool, bool, bool) + 268 1 QuartzCore 0x0000000188922d90 CA::OGL::PathFiller::PathFiller(CA::OGL::Context&, CA::Mat2 const&, CA::Bounds const&, CA::OGL::PathCubic*, int, CA::OGL::PathRect*, int, CA::OGL::PathFiller::ScanlinePoint*, int, bool, bool) + 48 2 QuartzCore 0x000000018885db28 CA::CG::fill_path(CA::CG::Renderer&, CGPath const*, CA::CG::StrokeParameters const*, CA::Rect const*, CA::ScanConverter::FillRule, CA::Mat2 const&, bool) + 2724 3 QuartzCore 0x00000001887ffe7c CA::CG::DrawOp::render(CA::CG::Renderer&) const + 1520 4 QuartzCore 0x00000001887fce5c CA::CG::Queue::render_callback(void*) + 1472 5 libdispatch.dylib 0x0000000180448910 _dispatch_client_callout + 16 6 libdispatch.dylib 0x000000018044ff74 _dispatch_lane_serial_drain + 952 7 libdispatch.dylib 0x00000001804509d4 _dispatch_lane_invoke + 376 8 libdispatch.dylib 0x000000018045b61c _dispatch_root_queue_drain_deferred_wlh + 284 9 libdispatch.dylib 0x000000018045ae90 _dispatch_workloop_worker_thread + 400 10 libsystem_pthread.dylib 0x00000001805f6114 _pthread_wqthread + 284 11 libsystem_pthread.dylib 0x00000001805f4e30 start_wqthread + 4 Thread 0: 0 libsystem_kernel.dylib 0x00000001805bb5a8 kevent_id + 8 1 libdispatch.dylib 0x000000018046bff4 _dispatch_event_loop_wait_for_ownership + 432 2 libdispatch.dylib 0x0000000180457f94 DISPATCH_WAIT_FOR_QUEUE + 336 3 libdispatch.dylib 0x0000000180457b5c _dispatch_sync_f_slow + 144 4 QuartzCore 0x00000001887e36a0 CABackingStoreGetFrontTexture(CABackingStore*, CGColorSpace*) + 184 5 QuartzCore 0x00000001887d374c -[NSObject(CARenderValue) CA_prepareRenderValue] + 228 6 QuartzCore 0x0000000188a2545c CA::Layer::prepare_contents(CALayer*, CA::Transaction*) + 188 7 QuartzCore 0x00000001887d0798 CA::Layer::prepare_commit(CA::Transaction*) + 276 8 QuartzCore 0x0000000188950e4c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 676 9 QuartzCore 0x00000001887ae8f0 CA::Transaction::commit() + 644 10 AppKit 0x0000000183fdcb18 __62+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayLink]_block_invoke + 268 11 AppKit 0x0000000184992f04 ___NSRunLoopObserverCreateWithHandler_block_invoke + 60 12 CoreFoundation 0x00000001806d6d80 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 13 CoreFoundation 0x00000001806d6c6c __CFRunLoopDoObservers + 528 14 CoreFoundation 0x00000001806d629c CFRunLoopRun + 772 15 CoreFoundation 0x00000001806d593c CFRunLoopRunSpecific + 604 16 HIToolbox 0x000000018ac9e448 RunCurrentEventLoopInMode + 288 17 HIToolbox 0x000000018ac9e0d8 ReceiveNextEventCommon + 216 18 HIToolbox 0x000000018ac9dfdc _BlockUntilNextEventMatchingListInModeWithFilter + 72 19 AppKit 0x0000000183eb4ed0 DPSNextEvent + 656 20 AppKit 0x000000018469feec -[NSApplication(NSEventRouting) nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 712 21 AppKit 0x0000000183ea837c -[NSApplication run] + 472 22 acord 0x0000000100c45290 P110TARGETAPP$$TTARGETAPPLICATION$$$_EVENTLOOP (p110TargetApp.pas:5781) 23 acord 0x0000000100bc82e8 PASCALMAIN (Accord.pas:154) 24 acord 0x000000010159ab40 FPC_SysEntry + 28 25 acord 0x000000010156f770 FPC_SYSTEMMAIN + 76 26 acord 0x0000000100bc814c main + 8 27 ??? 0x00000001802790e0 0x0 + 0 {....} Thread 14: 0 ??? 0x0000000000000000 0x0 + 0 Thread 9 crashed with arm64 Thread State: x21: 0x000000016f7bb270 x2: 0x0000000169a00658 x16: 0x00000001887fef60 x3: 0x000000016f7b6a20 x22: 0x000000016f7b6a20 x4: 0x0000000000000000 x17: 0x00000001887feeb0 cpsr: 0x0000000060001000 x5: 0x0000000000000000 x23: 0x0000000000000000 x6: 0x0000000000000001 x18: 0x0000000000000000 x10: 0x0000000188af7000 lr: 0x0000000188922d90 x7: 0x0000000000000000 x24: 0x0000000169a00658 x11: 0x0000000000000000 x8: 0x0000000000000007 x19: 0x000000016f7b6a70 x25: 0x0000000188b0d968 x9: 0x0000000000000001 x12: 0x0000000000000008 fp: 0x000000016f7b6960 x26: 0x000000016f7ca270 x13: 0x0000000000000009 pc: 0x0000000188923428 x27: 0x0000000000000001 x14: 0x0000000000000001 x20: 0x000000016f7b8a70 x0: 0x000000016f7ca270 sp: 0x000000016f7b6940 x28: 0x0000000000000000 x15: 0x0000000000000012 x1: 0x0000000144808e00 In Xcode we might see a divide by zero like: 0x189247428 <+268>: fdiv EXC_BAD_INSTRUCTION (code=1, subcode=0x2e23fc03) Any help with interpreting/debugging this type of crash would be appreciated.
Posted Last updated
.