macOS is the operating system for Mac.

Posts under macOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Sqlite database locked
Hi guys, 🙏I have a problem with repeated saving to the database. If I do the first update it is OK, but after the second attempt the update fails and the console says "Failed to commit transaction: database is locked". Here is my function: func updateMapCoordinates(radius: Int32) { // Otevření databáze, pokud není otevřená guard db != nil else { print("Database connection is nil") return } var statement: OpaquePointer? = nil let updateQuery = "UPDATE \(mapTable) SET radius = ? WHERE id = 1;" // Začátek transakce if sqlite3_exec(db, "BEGIN TRANSACTION", nil, nil, nil) != SQLITE_OK { let errorMessage = String(cString: sqlite3_errmsg(db)) print("Failed to begin transaction: \(errorMessage)") return } if sqlite3_prepare_v2(db, updateQuery, -1, &statement, nil) == SQLITE_OK { sqlite3_bind_int(statement, 1, radius) print("uložím \(radius)") if sqlite3_step(statement) == SQLITE_DONE { print("Coordinates saved successfully") } else { let errorMessage = String(cString: sqlite3_errmsg(db)) print("Failed to save coordinates: \(errorMessage)") } } else { let errorMessage = String(cString: sqlite3_errmsg(db)) print("SAVE statement could not be prepared: \(errorMessage)") } // Finalizace statementu sqlite3_finalize(statement) // Ukončení transakce if sqlite3_exec(db, "COMMIT", nil, nil, nil) != SQLITE_OK { let errorMessage = String(cString: sqlite3_errmsg(db)) print("Failed to commit transaction: \(errorMessage)") sqlite3_exec(db, "ROLLBACK", nil, nil, nil) } }
1
0
142
1w
Any emulator for Mac Silicon?
截至目前,有一些为苹果芯片的 Mac 设计的模拟器,比如 Parallels Desktop 和 VMware Fusion。这些模拟器支持在苹果芯片上的虚拟化,并提供了对 ARM 架构的一些支持。然而,并非所有移动应用程序或游戏都已经适配到苹果芯片上,因此是否有针对移动游戏完全适配到苹果芯片的模拟器?
0
0
112
1w
How to attach to Privileged Helper as root?
We have a Privileged Helper tool that we install with SMJobBless. I would like to debug it. I've added WaitForDebugger in our helper tool launchd plist and it does wait. But I can't attach to it via Debug->Attach to Process in Xcode with error: Code: 3 Failure Reason: tried to attach to process as user 'myusername' and process is running as user 'root' I set Debug process as: root in scheme settings. But I'm not sure if it does anything since I'm not running this particular scheme at the moment of attach. I tried unsuccessfully to set "Wait for the executable to be launched" but I had to create a new scheme for it since helper is built as part of the main app so maybe I did something wrong. Am I doing something wrong or is it not possible to attach to root process?
1
0
148
1w
Xcode won't symbolicate .ips crash log
I was my understanding that you're supposed to be able to open a .ips crash log in Xcode and see pretty much what you would see if the app had been running in the debugger when it crashed. But the addresses in my app don't get symbolicated. I opened the .ips in the same project and same version of Xcode that was used to create the app. The .dSym file is around, and I can use it to symbolicate using the atos tool. What am I missing?
2
0
139
1w
Cannot Add New Platform to Universal App
I am trying to add macOS as a new platform version to a universal app, which currently has an iOS and visionOS version. Every time I try I receive this error - "macOS: There was an unexpected error while adding this platform." I submitted a Feedback - FB14001529 I also submitted a TSI and a contact us report through App Store Connect. Any help from Apple on this issue would be great. Thanks, David
0
0
152
1w
SwiftUI chart - take screenshot of the chart view on macOS
Hello all, if I enable the .chartScrollableAxes(.horizontal) and .chartXVisibleDomain(length: length) for a chart view to zoom in the screenshot of the view misses the graphs. I use this extension: `extension View { @MainActor func snapshot() { let renderer = ImageRenderer(content: self) if let exportImage = renderer.nsImage { let pasteboard = NSPasteboard.general pasteboard.clearContents() pasteboard.writeObjects([exportImage]) } } }` The screenshot is taken with: Button("Snap") { let view = ChartView(text: $statusText, length: $chartLength) .padding() .frame(width: 1500, height: 500) view.snapshot() } If I omit .chartScrollableAxes(.horizontal) the snapshot is ok and the graphs are visible in the image but then a zoom is not possible and the whole range is shown. Any ideas?
1
1
262
1w
SMAppService Help!
I'm seeking some help or guidance. I'm attempting to write an app for private use that listens for HID events from a RF reader and responds. I have a functional app, which has to be launched via sudo, to be able to execute IOHIDManagerOpen(manager, IOOptionBits(kIOHIDOptionsTypeSeizeDevice)) correctly. I'm trying to modify this app, now, to use SMAppService and bypass the need for terminal and sudo, but I'm getting confused at what parts of my code need to be embedded into the helper and how to manage communications between the different components. I make it to step 8 in https://developer.apple.com/forums/thread/721737 before I start getting lost. Does anyone know of a functional, SIMPLE, sample app I could take a look at, or a good guide that lays out all parts of an example? Everything I've found gives the bones but no meat.
1
0
125
1w
WidgetKit extenstion
Hi, I'm trying to create a macOS widget for my application. I'm following the official Apple documentation. When trying to run the widget, I get the following error: The operation could not be completed. (CHSErrorDomain error 1103.) Is there a list somewhere that explains the error codes? I thought we were past error codes in modern software development...
8
2
1.1k
1w
UIAlertController no longer appears as a popover in macOS Sonoma
Prior to macOS 14, a Catalyst app could present a UIAlertController as a popover, just as you can on the iPad. While this still works on the iPad, the presentation on macOS now uses the same style as the iPhone. The UIAlertController's popoverPresentationController property is always nil, no matter how it is configured. Doe anyone know of a way to restore the prior behavior under Sonoma?
3
2
669
1w
Unreal 5.3 build failed, copied project from windows pc
I am having problems building an Unreal project in Xcode. The problem starts when the compiler starts to build a custom made plugin, that works perfectly fine on windows. When looking at the log, it seems that I will have to rebuild the plugin for macOS-arm64, does anyone have some ideas how I should approach? Showing All Messages ------ Building 4 action(s) started ------ [1/4] Link [Apple] Trancendent Undefined symbols for architecture arm64: "ExampleLibraryFunction()", referenced from: FTrancendantMetaNodesModule::StartupModule() in Module.TrancendantMetaNodes.cpp.o ld: symbol(s) not found for architecture arm64 /Users/Shared/Epic Games/UE_5.3/ld:1:1: ignoring file /Users/nicolaslefevre/Desktop/KanuziTemple/Plugins/TrancendantMetaNodes/Source/ThirdParty/TrancendantMetaNodesLibrary/Mac/Release/libExampleLibrary.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Total time in Parallel executor: 2.18 seconds Total execution time: 2.95 seconds /Users/Shared/Epic Games/UE_5.3/clang:1:1: linker command failed with exit code 1 (use -v to see invocation)
0
0
133
1w
Invalid 'com.apple.application-identifier' entitlement value.
I already have an iOS app accepted on the App Store, and now I want to add a macOS platform version. I created a new Xcode project and used the same bundle ID as my iOS app. When I tried to upload the macOS bundle, I encountered the following error: Invalid Provisioning Profile. The provisioning profile included in the bundle ABC.123456 [ABC.123456.pkg/Payload/ABC.app] is invalid. [Invalid 'com.apple.application-identifier' entitlement value.] For more information, visit the macOS Developer Portal. (ID: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx) I found that this problem occurs when the "Team ID" and "App ID Prefix" are different. How can I make them match?
1
0
130
1w
Can one use the new provenance feature to avoid slow notarization checks for newly compiled unsigned binaries?
I am working with a compiler that produces native binaries, It's really meant for servers so it's not integrated with Xcode or the Xcode build system. As such the output binaries get the default ad-hoc signatures the linker makes. After (re)compiling such a binary, there is a delay whilst running it. This is because macOS notices it's an unknown binary and goes off to ask notarization servers/Xprotect if it's known malware. Fine, I understand the need for this and why it happens. From the logs it's clear that macOS is now tracking the "provenance" of binaries. This means where they came from. This raises the question of whether it could know that my local dev binaries are coming from this compiler, if it was in turn properly signed and notarized. And if so, whether there is some security policy I could set to say "if binary X produces binary Y, then trust Y". Yes I know this would be a security exploit if it were done that way by default, but I am willing to take the risk of special malware that compiles itself first using this special compiler that isn't installed by default then runs the output, as presumably any such malware would be so targeted Xprotect/notarization wouldn't know about it anyway. The provenance mechanism is some internal security thing and isn't documented, but I'm curious if anyone knows more about it and whether it's usable for this? Or alternatively if there's a way to stop macOS doing these slow checks for certain binaries e.g. under specific paths?
2
0
139
1w