target_os_mac is not working

Since we used ActivityKit which is iOS16 ability, it works good on iphone. But not good for apple silicon mac, which will crash because of the activitykit could not be founded.So we try to use #if TARGET_OS_IPHONE import ActivityKit #endif to avoid the crash. And it's not working as expect. We tried #if canImport(ActivityKit) , it's not working either.

ProcessInfo.processInfo.isiOSAppOnMac

target_os_mac is not working
 
 
Q