【发布时间】:2015-03-16 11:54:41
【问题描述】:
如果有 iOS 蓝牙经验的人能告诉我如何使用蓝牙类在其他 iOS 设备上拍照,我将不胜感激。这个应用程序允许用户登录/注册,然后拍摄和上传照片。 http://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12 我的目标是,点击应用程序 uiscrollview(显示所有上传的照片)中的用户照片,激活下面 AVFoundation 的 snapStillImage 方法。
//this code takes a picture
- (void)snapStillImage //this takes a picture via [self snapStillImage] in viewDidLoad
{
dispatch_async([self sessionQueue], ^{
// Update the orientation on the still image output video connection before capturing.
[[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]];
// Flash set to Auto for Still Capture
[ViewController5 setFlashMode:AVCaptureFlashModeAuto forDevice:[[self videoDeviceInput] device]];
// Capture a still image.
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer)
{
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
photo.image = [[UIImage alloc] initWithData:imageData];
[[[ALAssetsLibrary alloc] init] writeImageToSavedPhotosAlbum:[photo.image CGImage] orientation:(ALAssetOrientation)[photo.image imageOrientation] completionBlock:nil];
[self uploadPhoto];
}
}];
});
}
我想每个用户在登录时都需要成为中心/外围设备吗?我在 iOS 上设置 BLE 的经验为 0,更不用说配备服务器功能了。任何想法或提示都会很棒。
【问题讨论】:
标签: ios bluetooth core-bluetooth