I've set up a Notification Content Extension for my app, but it's not getting called(tried both local and remote push). I've read the Apple dev guide, and I've set up everything as it says. https://developer.apple.com/documentation/usernotificationsui/customizing_the_appearance_of_notifications
I've looked over the common issues (setting proper deployment targets and setting category identifiers from the backend and in the .plist)
After receiving the notification, I'm not able to get the expanded view and neither is the didReceive(_ notification: UNNotification) of my extension view controller getting invoked. Is there something I'm missing while doing the extension setup, I m not able to figure out the problem?
Also, I m not able to understand this note from apple
"Notification content app extensions are supported only in iOS apps"
when all the Notification content Extension APIs are provided for MacOS also?
Post
Replies
Boosts
Views
Activity
I have created a Notification service extension as target to the main MacOS application. I want to update the content of my remote notification using this extension but due to some reason the extension is not getting invoked to update my remote notification.
The auto execution of the below method seems to fail for my app extension.
didReceive(_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping
(UNNotificationContent) -> Void)
I have tried the suggested solutions in this link but it did not help. Maybe there are some differences to using Notification service for MacOS and ios that I m not aware.
I am able to send normal remote notifications using the curl command, but it is not invoking the notification service extension. Below is the curl command.
curl -v --header "apns-topic: $TOPIC" --header "apns-push-type: alert" --header "authorization: bearer $AUTHENTICATION_TOKEN" --data '{"aps": {"mutable-content": 1,"alert": {"title": "Encrypted title","body": "Encrypted body"}},"MEETING_ORGANIZER": "MyMeet"}' --http2 https://${APNS_HOST_NAME}/3/device/${DEVICE_TOKEN}
Is there anything I m missing that is causing this problem?
I m using Mac Automator app to add new actions to the right click quick menu for files and folder. As can we seen in the image we have a number of actions available for mail app, Calendar, photos and other apps. I wanted to know whether something similar can be done for my app. I wanted to list my app in the library and provide some similar action options. Can it be done?
I m trying to identify if my launched process is running on a local mac machine(desktop/laptop) or a virtual macOS X instance like AWS EC2, Azure, MacStadium etc.
I have followed this link which searched for its limited providers in the output, but I m not bound to any limited providers and looking for a general solution which is applicable to all the providers.
Is there some hardware/network/virtualization-related information that can be used to identify if the process is launched on a virtual MacOS instance?
OR is there some system Information that I can use to be sure that my process is running on a local machine?
I m trying to identify if my launched process is running on a local mac machine(desktop/laptop) or a virtual macOS X instance like AWS EC2, Azure, MacStadium etc.
I am using the below check for this:
1 . If running on native Apple hardware, the returned value contains the model name of the hardware:
$ sysctl -n hw.model
Macmini8,1
On virtualized hardware, the value may contain the hypervisor name:
$ sysctl -n hw.model
VMware7,0
If the command output doesn't contain the "Mac" substring, the malware considers that it is running in a virtual machine.
2. Checking USB device vendor names
The commands used:
ioreg -rd1 -c IOUSBHostDevice | grep "USB Vendor Name"
Sample output on native Apple hardware:
"USB Vendor Name" = "Apple Inc."
"USB Vendor Name" = "Apple Inc."
"USB Vendor Name" = "Apple, Inc."
On virtualized hardware, the value may contain the hypervisor name:
"USB Vendor Name" = "VirtualBox"
"USB Vendor Name" = "VirtualBox"
A virtual machine can be detected by checking if the command output contains a hypervisor name, for example "VirtualBox", "VMware", etc.
3 . Checking the "IOPlatformExpertDevice" registry class
The command used:
ioreg -rd1 -c IOPlatformExpertDevice
The following fields of the IOPlatformExpertDevice class can be checked in order to detect a virtual machine:
I wanted to know can a combination of these be used to identify a process running on a Cloud VM with certainity?
Hi,
I am an absolute beginner at IOKit registry and have a usecase to obtain the device manufacturer name, device serial number and device USB vendor name progrmatically. I m able to obtain the same using ioreg command but I wanted to get these values within my program. Thanks in advance.
Device serial number:
ioreg -rd1 -c IOPlatformExpertDevice | grep 'IOPlatformSerialNumber'
Device manufacturer name:
ioreg -rd1 -c IOPlatformExpertDevice | grep 'manufacturer'
USB device vendor names:
ioreg -rd1 -c IOUSBHostDevice | grep "USB Vendor Name"
I have a need to interoperate between cpp and swift. Here when we return a 'String' type from swift to cpp, the type that we receive in cpp is 'swift::string'.
I wanted to convert 'swift::string' to char* in cpp. Any help on how can this be achieved in cpp?
I have been using the Cpp-Swift Interoperability in Xcode15 for direct communication between Cpp and Swift code. It required a few Build settings changes for the Swift Compiler and creating clang modules to access cpp code in swift.
I wanted to use this interoperability feature in my visual studio project which is using Cmake. I m not able to find the Xcode attribute property flags for my cmake to enable this interoperability. Can someone help with this?
I have been using the Cpp-Swift Interoperability in Xcode15 for direct communication between Cpp and Swift code. It required a few Build settings changes for the Swift Compiler, creating clang modules(module map file) to access cpp code in swift, specifying module map path to the swift compiler etc.
I wanted to use this interoperability feature in my visual studio project which is using Cmake. I want to build via cmake, using Xcode generator.
Prior to Swift5.9, we were using a ObjC bridging header whose support was provided in the Cmake using the Xcode attribute flag 'XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER'. Similarly we were specifying the generated header using the attribute 'XCODE_ATTRIBUTE_SWIFT_OBJC_INTERFACE_HEADER_NAME'
I m not able to find similar Xcode attribute property flags for my Cmake to enable this interoperability. What are the changes that we need to make in the Cmake(using Xcode generator) for this new interoperability to work. Can someone help with this?
I am creating an Xcode project using xcode generator in Cmake. The project has a library which contains cpp files and swift files. I m trying to test swift-cpp interoperability that is introduced in xcode15 to perform direct cpp calls from swift and vice-versa. For this to work, we need to set a xcode build setting 'C++ and Objective-C Interoperability' which I m doing via cmake, Below is my cmake file:
cmake_minimum_required(VERSION 3.18)
project(CxxInterop LANGUAGES CXX Swift)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_Swift_LANGUAGE_VERSION 5.0)
add_executable(CxxInterop ./Sources/CxxInterop/main.swift
./Sources/CxxInterop/Student.cpp
)
#include the directory with modulemap file and Student.hpp
target_include_directories(CxxInterop PUBLIC
${CMAKE_SOURCE_DIR}/Sources/CxxInterop)
#setting the xcode C++ and Objective-C Interoperability setting
target_compile_options(CxxInterop PRIVATE
"-cxx-interoperability-mode=default")
when building the generated xcode project I get the error unknown argument: '-cxx-interoperability-mode=default'.
However the weird thing is when I separate out the cpp code in a different library and swift files in a different one, then this works and I m able to invoke the cpp methods in my swift file after importing the clang module from the module map file.
Is there any reason to why having cpp and swift files in same library producing this error? I m following this link to setup the project via cmake.
I m trying to create an xcode project with cpp-swift interoperability(introduced in xcode15) using cmake xcode generator. I m able to invoke cpp code in swift and vice-versa but when opening the project in xcode, the build setting for 'C++ and Objective-C Interoperability' is still set to 'C/Objective C' like in image below. I want to set it to 'C++/Objective-C++'.
I m using the below cmake for this:
.
.
add_library(cxx-support ./Sources/CxxSupport/Student1.cpp
./Sources/CxxSupport/Teacher.swift
)
#include the directory to access modulemap content
target_include_directories(cxx-support PUBLIC
${CMAKE_SOURCE_DIR}/Sources/CxxSupport)
target_compile_options(cxx-support PUBLIC
"$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>"
)
.
.
I Have also tried the below in cmake, but it didn't work.
#set(SWIFT_OBJC_INTEROP_MODE "objcxx" CACHE STRING "")
#target_compile_options(cxx-support PUBLIC
#"SWIFT_OBJC_INTEROP_MODE=objcxx")
Any help on how this can be achieved?
I am having a usecase where I wanted to detect the system language change event under OS X. I went throught the available options in NSNotification.Name , but did not find anything helpful. I found a similar link but it seems to be no longer applicable.
Any help on how this can be achieved?
I have a project where I m making direct swift calls from cpp as introduced in swift5.9. Below is my swift class whose method is being invoked on cpp.
import Foundation
public class MySwiftClass
{
public static func testInterop () -> Void {
NSLog("----------- hey --------")
}
}
I m able to successfully invoke 'testInterop()' in cpp with the above class, however if I add conformance to NSObject in the 'MySwiftClass' class, then the swift call fails with the error "No member named 'MySwiftClass' in namespace 'Module2'", where Module2 is my swift target.
I m not able to identify why is this happening. Any help?
In the mac general setting, we can provide the language preference for an individual application like in the image below, I have provided for TextEdit app.
Now based on the system preferred languages, TextEdit will have a default language. However if I explicitly set the language for TextEdit (arabic in my example), then the application will use that language. I wanted to identify in my program the language that an app is currently running in. I have tried the below code, but it always return 'en', even after my preference is set to 'Arabic'.
let u = URL(fileURLWithPath: "/System/Applications/TextEdit.app")
let b = Bundle(url: u)!
let textedit_preference = b.preferredLocalizations
print(textedit_preference) //["en"]
How can I identify what language is being set by the user for an individual application? I have followed this link but it does not contain this information.
I was going through this apple documention and it states, "By default, the generated header contains interfaces for Swift declarations marked with the public or open modifier", however, In my Xcode project, the public methods are not visible in the objective C code, and only the methods that are marked with @objc are visible. Is there some problem in my code or Is this a bug?