Thanks for the response.
On a different note, I have an application that is meant to be run as a daemon. What is it that the apple recommends on how to create the daemon application(in terms of creating the event loop)?
From apple documentations, I understand that we should be using only daemon safe frameworks for creating a daemon application. According to it, we are not allowed to use Appkit( hence we cannot use the delegate implicit event loop).
What is the alternative to it, how to create the event loop now?
Post
Replies
Boosts
Views
Activity
It is a non-interactive bundled application but it can be run in both gui and non-gui context.
In non-gui context(like ssh terminal), this is launched using daemons or using the unix executable in the bundle like ..
cd MyApp.app/Content/MacOS
./MyApp
In the gui context, the program can be launched by double clicking the bundled app or using 'open' command.
If something is running in a non-GUI context then it’s not an app.
For the above statement, If my application is capable of running in non-gui context, then what is it that the apple recommends doing. Should I be not creating a bundled application?
This is solved. I am now able to handle the intent in the shortcuts app using the 'Intents extension'. However, I have a observed something which is not in alignment with the apple documentation.
This property which is specified in the .plist file for the intents extension is not available for macOS according to their documentation. However, it is observed that I m not able to handle the intents without using this property and it should be specified for macOS. Is this something being missed in the documentation?
@JWWalker NSWorkspace.notificationCenter seems to be no longer supported. It is giving the above error.
To what end?
My primary goal to performing exception handling is that when an exception occurs, I want to be able to perform proper finalization(like closing open file handles and ports etc.) for my application before the exception causes my application to terminate. Additionally, I want to show an alert box to the user informing him about the steps to take in case the exception can be recovered like providing a restart button If that could help. I want to be able to provide a better user experience.
@eskimo Can you please revert on this?
I have tried this in an independent project and it works. However, I have figured out the reason why I m getting this error and wanted your help on how to resolve this.
My project is using the new interop mechanism using the modulemap file. For this, I m setting the interoperability to c++ in the build setting. After changing the interoperability to C++, I m getting this error for the SessionGetinfo Api. Can you please check this?
public static func GetSessionInfo () -> Void
{
var sessionID = SecuritySessionId()
var sessionAttrs = SessionAttributeBits()
let status = SessionGetInfo(callerSecuritySession,
&sessionID,
&sessionAttrs) //error:Cannot convert value of type 'UnsafeMutablePointer<SessionAttributeBits>' to expected argument type 'UnsafeMutablePointer<UInt32>'
if status != errSessionSuccess {
print("Could not get session info. Error \(status)")
}
}
You can try this in your project.
Can somebody take a look on this as priority? Its been a week after posting here in this developer forum too...
I have also tried setting the cpp macros in Apple clang but it's also not identified in swift.
I have reproduced this problem without cmake. Can you help now?
I have an Xcode project containing a cpp target and a swift target. I am making direct swift to cpp call by exposing cpp to swift using the modulemap file. For the cpp target, I have defined some macros which I m using in the cpp header contained in the modulemap file. I m able to successfully build the cpp target. However, when I build the swift target I get an error message stating that the macros are not declared. When swift tries to import the cpp header via the clang module, it is not able to identify the cpp macros.
I m setting the macros in the Compiler flags for the cpp file. You can see this in the image below. One of the macro(WINDOW_KERNEL) is defined with some value.
error:Use of undeclared identifier 'WIN32'
error:Use of undeclared identifier 'WINDOW_KERNEL'
I m also using Xcode 15.2, but I m still getting this error. I am having a macOS GUI project.
I m setting these preprocessor compillation flags in the cmake file using add_compile_definitions command. These flags are appearing in the Swift Compiler custom flags(under Active Compilation Conditions), But the swift is producing an error as above.
I have tried the below solution, but it seems to be unsafe as it is giving warning:
// swift method that return UnsafeMutablePointer which gets casted to char * in cpp
let x = mySwiftString.cString(using: .utf8)
return UnsafeMutablePointer<CChar>(mutating: x)
// warning at return : Initialization of 'UnsafeMutablePointer<CChar>' (aka 'UnsafeMutablePointer<Int8>') results in a dangling pointer
I tried running sysctl kern.hv_vmm_present on the terminal in Amazon EC2 VM, however it does not give the right output. Even on a cloud VM it returns kern.hv_vmm_present: 0. Any reasons why or how can I identify the process running on VM?