//檢查前後網路攝影機BOOL cameraAvailable = [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear];//前BOOL frontCameraAvailable = [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront];//後//檢查指南針 CoreLocation.framework <CoreLocation/CoreLocation.h>BOOL magnetometerAvailbale = [CLLocationManager headingAvailable];//檢查聲音支援 AVFoundation.framework <AVFoundation/AVFoundation.h>AVAudioSession *audioSession = [AVAudioSession sharedInstance]; //返回一個AVAudioSession執行個體BOOL audioAvailable = audioSession.inputAvailable;//bool值。擷取是否支援//檢查錄影支援 MobileCoreServices.framework <MobileCoreServices/MobileCoreServices.h>- (BOOL)isvideoCameraAvailable{ //簡單檢查所有的可用的媒體資源類型,然後檢查返回的數組,如果其中包含了kUTTypeMovie的NSString類型對象,就證明網路攝影機支援錄影 UIImagePickerController *picker = [[UIImagePickerController alloc]init]; NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];//返回所支援的media的類型數組 [picker release]; if (![sourceTypes containsObject:(NSString *)kUTTypeMovie]) {//containsObject確定數組中是否包含後面的對象 return NO; } return YES;} //檢查陀螺儀可用 CoreMotion.framework <CoreMotion/CoreMotion.h>- (BOOL) isGyroscopeAvailable{#ifdef __IPHONE_4_0//4.0之後才有 CMMotionManager *motionManager = [[CMMotionManager alloc]init]; BOOL gyroscopeAvailable = motionManager.gyroAvailable; [motionManager release]; return gyroscopeAvailable;#else return NO;#endif}