Xamarin iOS:禁用屏幕截图选项(Xamarin iOS: Disable screenshot option)

编程入门 行业动态 更新时间:2024-10-14 02:21:04
Xamarin iOS:禁用屏幕截图选项(Xamarin iOS: Disable screenshot option)

我正在研究一个具有非常敏感数据的应用程序,我们不希望在任何地方保存这些数据。 在Android中,我们可以禁用截图。 有没有办法在iOS上做同样的事情? 我不希望任何访问敏感信息的用户尝试截图。

PS。 我正在使用xamarin表单来创建应用程序,但如果这个功能可以通过客观的C / swift实现,它们总是可以通过xamarin来实现。

I am working on an app which has very sensitive data, which we do not want to be saved anywhere. In Android we can disable taking screenshot. Is there a way to do the same on iOS? I do not want any user who access sensitive information to try to take screenshot.

PS. i am using xamarin forms to create the app, but if this functionality can be achieved through objective C/ swift, they can always be achieved through xamarin.

最满意答案

您无法阻止用户在iOS上截屏。 但是,由于您的担心与安全性有关,所以您可能需要考虑的一件事就是防止操作系统在最近使用的应用程序列表中显示应用程序的屏幕截图,这可以在用户将应用程序最小化时完成。 要这样做(使用Xamarin),您需要在AppDelegate覆盖OnResignActivation和OnActivated :

// Hide app state in recently used apps list public override void OnResignActivation(UIApplication application) { var view = new UIView(Window.Frame) { Tag = new nint(101), BackgroundColor = UIColor.White } Window.AddSubview(view); Window.BringSubviewToFront(view); } // Remove window hiding app content when app is resumed public override void OnActivated(UIApplication application) { var view = Window.ViewWithTag(new nint(101)); view?.RemoveFromSuperview(); }

我意识到这并不能回答你的问题,但它可能是可以做到的。

You cannot prevent users from taking screenshots on iOS. However, since your concerns are security related, one thing you might want to consider is preventing the OS from displaying a screenshot of your app in the recently used apps list when users have the app minimised, which can be done. To do so (using Xamarin), you need to override OnResignActivation and OnActivated in your AppDelegate:

// Hide app state in recently used apps list public override void OnResignActivation(UIApplication application) { var view = new UIView(Window.Frame) { Tag = new nint(101), BackgroundColor = UIColor.White } Window.AddSubview(view); Window.BringSubviewToFront(view); } // Remove window hiding app content when app is resumed public override void OnActivated(UIApplication application) { var view = Window.ViewWithTag(new nint(101)); view?.RemoveFromSuperview(); }

I realise this doesn't answer your question, but it may be as much as can be done.

更多推荐

本文发布于:2023-08-04 11:19:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415230.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:截图   选项   屏幕   iOS   Xamarin

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!