在 XCode 中模拟加速度计、麦克风和摄像头
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/886004/
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
Simulating accelerometers, microphone and camera in XCode
提问by Fuzzy Purple Monkey
Is it possible to simulate movement (ie the accelerometers), microphone and camera in the XCode simulator?
是否可以在 XCode 模拟器中模拟运动(即加速度计)、麦克风和摄像头?
If so, how do you do it?
如果是这样,你怎么做?
If not, are there any XCode addins or third party apps that do it? (apart from downloading to an actual iPhone of course).
如果没有,是否有任何 XCode 插件或第三方应用程序可以做到这一点?(当然,除了下载到实际的 iPhone 之外)。
Thanks in advance!
提前致谢!
回答by Kekoa
The easiest way I found to do it is using the Wavefront Accelerometer Data Appthat can be found in the App Store. All you need to do is add a single file to your application then you can use the accelerometer in your iPhone or iPod touch to send data to your app in the simulator. You'll need a WiFi connection, and a device to use.
我发现最简单的方法是使用可在 App Store 中找到的Wavefront Accelerometer Data App。您需要做的就是向您的应用程序添加一个文件,然后您就可以使用 iPhone 或 iPod touch 中的加速度计将数据发送到模拟器中的应用程序。您需要有 WiFi 连接和要使用的设备。
You could probably find a solution that runs on the desktop, but you won't be getting accurate real life readings.
您可能会找到在桌面上运行的解决方案,但您将无法获得准确的现实生活读数。
I would recommend getting an actual device or your app can behave different than you expect it to. If this is a serious endeavor, you should be able to justify the cost of a device. An iPod Touch is much cheaper but you don't get the phone or camera capability. You can get a headset that has a microphone though.
我建议您使用实际设备,否则您的应用程序的行为可能与您预期的不同。如果这是一项认真的努力,您应该能够证明设备的成本是合理的。iPod Touch 便宜得多,但您没有电话或相机功能。不过,您可以获得带有麦克风的耳机。
Those are the limitations, I don't think it wise to develop an app without testing it on a device. I've run into apps that crash all the time and figure it's because they are getting away with stuff in the simulator that you can't do in the memory and cpu constraints of the device.
这些是限制,我认为在没有在设备上测试的情况下开发应用程序是不明智的。我遇到过一直崩溃的应用程序,并认为这是因为它们在模拟器中逃脱了在设备的内存和 CPU 限制中无法做到的事情。
回答by kolinko
Microphone works in the simulator. It uses a standard mic input from your mac.
麦克风在模拟器中工作。它使用来自 Mac 的标准麦克风输入。
回答by matiasfh
In the android simulator the hardware can't be simulated .. but for example for the camera i see an approach to get real information ... Use your webcam .. to do that you can get frames with an app and send this data with a socket to the simulator... maybe it's possible to do that with iPhone simulator.
在android模拟器中,硬件无法模拟..但例如对于相机,我看到了一种获取真实信息的方法......使用你的网络摄像头..这样做你可以通过应用程序获取帧并发送这些数据一个连接到模拟器的插座......也许可以用 iPhone 模拟器来做到这一点。
I see this solution here
我在这里看到这个解决方案
回答by S.P.
Check this link....
检查此链接....
http://media.wiley.com/product_data/excerpt/72/04705009/0470500972-1.pdf
http://media.wiley.com/product_data/excerpt/72/04705009/0470500972-1.pdf
and go to 10 th page..
并转到第 10 页..
However, the iPhone Simulator, being a software simulator for the real device, does have its limitations. Features not available on the iPhone Simulator include: Obtaining location data — it returns only a ? xed coordinate, such as Latitude 37.3317 North and Longitude 122.0307 West
但是,iPhone Simulator 作为真实设备的软件模拟器,确实有其局限性。iPhone 模拟器上不可用的功能包括: 获取位置数据——它只返回一个 ? 固定坐标,例如北纬 37.3317 和西经 122.0307
Making phone calls
Accessing the Accelerometer
拨打电话
访问加速度计
Sending and receiving SMS messages
发送和接收短信
Installing applications from the App Store
Camera
Microphone
从 App Store
相机
麦克风安装应用程序
Several features of OpenGL ES
OpenGL ES的几个特性