如何防止在flutter ios中拍摄屏幕拍摄

发布于 2025-02-01 01:49:53 字数 466 浏览 4 评论 0原文

我有一个教育ios应用程序。而且我想防止用户在特定屏幕上获取屏幕截图或屏幕记录以及如何使其尝试

进行许多解决方案

这里 它仍然记录直到我到达特定屏幕并将我推回去并向我展示此警报对话框 如何实现此功能

“屏幕记录”

I've got an education flutter iOS app. and I want to prevent users to take screenshots or screen records on a specific screen and how to make it

I'm trying many solutions here but no one is working

as attached below, it is a screen record form my iPhone from another app
it still records till I reach to specific screen and push me back and showing me this alert dialog
how to achieve this feature

Screen Record

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤寂小茶 2025-02-08 01:49:53

实际上,App Store可以防止此功能禁用屏幕截图,因此我们可以解决此操作。我的解决方案是使用户进行屏幕截图,但没有数据。我通过这个简单的代码实现了


import UIKit
import Flutter
import FirebaseCore

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  private var textField = UITextField()
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    self.window.makeSecure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
  // Screenshot Prevent Functions
 

      // <Add>
  override func applicationWillResignActive(
    _ application: UIApplication
  ) {
    self.window.isHidden = true;
  }
  override func applicationDidBecomeActive(
    _ application: UIApplication
  ) {
    self.window.isHidden = false;
  }

  
}
  extension UIWindow {
   func makeSecure() {
    let field = UITextField()
    field.isSecureTextEntry = true
    self.addSubview(field)
    field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
    field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
    self.layer.superlayer?.addSublayer(field.layer)
    field.layer.sublayers?.first?.addSublayer(self.layer)
  }
}

Actually, APP Store Prevent this feature which is disable screenshot so we can work around to do this. my solution was to make user make an screen shot but with no data. I achieve it by this simple code


import UIKit
import Flutter
import FirebaseCore

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  private var textField = UITextField()
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    self.window.makeSecure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
  // Screenshot Prevent Functions
 

      // <Add>
  override func applicationWillResignActive(
    _ application: UIApplication
  ) {
    self.window.isHidden = true;
  }
  override func applicationDidBecomeActive(
    _ application: UIApplication
  ) {
    self.window.isHidden = false;
  }

  
}
  extension UIWindow {
   func makeSecure() {
    let field = UITextField()
    field.isSecureTextEntry = true
    self.addSubview(field)
    field.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
    field.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
    self.layer.superlayer?.addSublayer(field.layer)
    field.layer.sublayers?.first?.addSublayer(self.layer)
  }
}
铜锣湾横着走 2025-02-08 01:49:53

如果您不希望用户在应用程序中使用屏幕截图,请使用此功能。
flutter_windowmanager

通过使用此软件包,您可以添加更多功能,例如Blur应用程序,在后台强制强制强制填充应用程序屏幕,解散关键守卫。

阅读Dicumentation以获取更多信息。

Use this if you don't want users to take screenshots in your app.
flutter_windowmanager

By using this package, you can add many more functionality like blur app when its in background, force full screen, dismiss keyguard.

Read the dicumentation for more info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文