Hi everyone,
Is there any way to detect an app is being mirrored from an iPhone to macOS via iPhone Mirroring (new feature from iOS18 and macOS 15 Sequoia)?
My app has a business requirement to disable screen mirroring and recording (or just display a black screen when it's active). However, the current implementation doesn't seem to work with iPhone Mirroring to macOS. Is there any solution for this? Because as far as I know, seems like there is no API to detect it
What I've tried so far
1. Count the UIScreen
var totalScreens = UIScreen.screens.count
Screen counts:
iPhone only (without mirroring or airplay): 1
iPhone Airplay (screen mirroring): 2
iPhone Mirroring (iOS18) to MacOS15: 1
conclusion: both iPhone only and iPhone mirroring to macOS returns the same screen count (no difference)
2. Mask the entire screen with passwordTextField.isSecureTextEntry= true
Result
iPhone screen recording: Black screen
iPhone screen mirroring (AirPlay): Black screen
iPhone Mirroring (with macOS): No blackscreen, it works as usual
The implementation is similar to https://stackoverflow.com/a/67054892 and https://forums.developer.apple.com/forums/thread/736112?answerId=765331022#765331022
What I want to achieve is something like the FairPlay Streaming API (https://developer.apple.com/streaming/fps/), where it turns the screen black when a screenshot, screen recording, screen mirroring, or iPhone mirroring is active.
Thank you
Post
Replies
Boosts
Views
Activity
Hi everyone,
I’m working on an app that uses WKWebView. Due to security concerns, our customers want the app to disable copy-paste functionality and similar options (such as Lookup and Share, allowing users to extract text from the app or save it as a file.
I was able to disable copy-paste and remove UIMenu options like Lookup and Share.
Everything worked fine until the iOS 18.1 beta, which introduced a new menu called Writing Tools (Apple Intelligence) that has its own copy and share buttons
I've tried several ways to remove it
Remove all UIMenu items using canPerformAction, and it works for all menus but Writing Tools, which still remains
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return false
}
Remove it from UIMenuBuilder
override func buildMenu(with builder: UIMenuBuilder) {
builder.remove(menu: .lookup)
builder.remove(menu: .share)
}
But unfortunately, UIMenuBuilder does not have an identifier for Writing Tools, and it seems like there are no API changes from Xcode 15 to Xcode 16 (https://developer.apple.com/documentation/uikit/uimenu/identifier)
It seems like the only way to disable it through MDM configuration (key: allowWritingTools), but we don't use MDM
https://developer.apple.com/documentation/devicemanagement/restrictions
Environment
iOS Version: iOS 18.1 beta4
Device: iPhone 15 Pro
App platform: iOS
Xcode version: 16.0
MacOS: 15.0
Thank you