ios 在 iPhone 上远程打开相机
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19039836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Turn camera on remotely on iPhone
提问by Chris Young
I know an app like this would NEVER get approved on the app store. But being a developer, I was wondering if anyone knew of a way to turn on the device camera remotely. it would be handy to use personally for security.'
我知道这样的应用程序永远不会在应用程序商店获得批准。但是作为开发人员,我想知道是否有人知道远程打开设备摄像头的方法。为了安全起见,个人使用会很方便。
EDIT: I would like to find a way without jailbreaking the device, and I would guess with the new iOS 7, and multitasking there should be a way to create a delegate that should be able to turn on the camera to an app running in the background.
编辑:我想找到一种不越狱设备的方法,我猜在新的 iOS 7 和多任务处理中应该有一种方法来创建一个委托,该委托应该能够打开相机到在背景。
回答by ilya n.
It's absolutely not possible on 'regular' iOS for your app to come to foreground without some user action. It's also not possible to record video or take pictures in the background. This is by design.
如果没有一些用户操作,您的应用程序在“常规”iOS 上绝对不可能出现在前台。也无法在后台录制视频或拍照。这是设计使然。
If your app is running in the foreground, you're free to take pictures and video using AVCaptureSession
. You can start and stop anytime you like and the user is not presented with any visual indication. I believe there are some home camera apps in the store that do exactly that.
如果您的应用程序在前台运行,您可以使用AVCaptureSession
. 您可以随时开始和停止,并且不会向用户显示任何视觉指示。我相信商店里有一些家用相机应用程序可以做到这一点。
回答by Jasarien
You could go the jailbroken route, and do what you like - but I don't know anything about that. Maybe someone else will.
你可以走越狱路线,做你喜欢做的事——但我对此一无所知。也许别人会。
Any non-jailbroken solution would have to rely on the app running in the foreground. If you can guarantee that, then you could enable the camera remotely by embedding a server within the app that listens for commands from a remote client. Once a command is received you could execute the code to open the camera.
任何未越狱的解决方案都必须依赖于在前台运行的应用程序。如果你能保证这一点,那么你可以通过在应用程序中嵌入一个服务器来远程启用相机,该服务器侦听来自远程客户端的命令。收到命令后,您可以执行代码以打开相机。
As for taking a picture or video, I'm not sure what the options would be there. The standard camera picker views use Apple provided UI that requires the user to start the video or take the picture, but I imagine you could just create an AVCapturePreview layer and screenshot periodically it or something.
至于拍摄照片或视频,我不确定那里有哪些选择。标准的相机选择器视图使用 Apple 提供的 UI,要求用户启动视频或拍照,但我想你可以创建一个 AVCapturePreview 层并定期对其进行截图或其他东西。
So in summary, there are solutions to this problem, but the more useful ones would rely on jailbreaking for full remote control.
所以总而言之,这个问题有解决方案,但更有用的将依赖越狱进行完全远程控制。