Can I detect if an imported ALAsset photo was taken via screenshot?

吃可爱长大的小学妹 提交于 2019-12-03 16:03:57

For screenshot, its UTI is always a "public.png" and same size as screen (be sure you have multiply [UIScreen scale] on screen bounds width and height), just need to check these 2 metadata, you can easily identify screenshot.

Add MetaData to UIImage while saving to Photo Library. Same metadata of UIImage can be used to know if its screenshot or not.

Refer Save_Photo_to_Album_with_Metadata

Well, I was researching and experimenting .. and the closest solution I've found is based on the fact that iPhone screenshots don't yield EXIF records (while all other generated photos do generate them).

Therefore, once a photo is selected in the picker, I'm checking if the photo's metadata consists an EXIF record and if it doesn't - I conclude that the photo was screenshot.

I found it's the "as good as it gets" solution for now, although it's not an official one.

Cheers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!