File tree 2 files changed +10
-2
lines changed 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,13 @@ - (id)init {
213
213
}
214
214
}
215
215
216
+ - (BOOL )isSimulator {
217
+ return [[[UIDevice currentDevice ].model lowercaseString ] rangeOfString: @" simulator" ].location != NSNotFound ;
218
+ }
219
+
216
220
- (void )startSession {
221
+ if ([self isSimulator ]) return ;
222
+
217
223
dispatch_async (self.sessionQueue , ^{
218
224
if (self.presetCamera == AVCaptureDevicePositionUnspecified) {
219
225
self.presetCamera = AVCaptureDevicePositionBack;
@@ -256,6 +262,8 @@ - (void)startSession {
256
262
}
257
263
258
264
- (void )stopSession {
265
+ if ([self isSimulator ]) return ;
266
+
259
267
dispatch_async (self.sessionQueue , ^{
260
268
[self .previewLayer removeFromSuperlayer ];
261
269
[self .session stopRunning ];
@@ -321,7 +329,7 @@ - (void)initializeCaptureSessionInput:(NSString *)type {
321
329
322
330
- (void )captureStill : (NSInteger )target options : (NSDictionary *)options callback : (RCTResponseSenderBlock)callback {
323
331
dispatch_async (self.sessionQueue , ^{
324
- if ([[[UIDevice currentDevice ].model lowercaseString ] rangeOfString: @" simulator " ]. location != NSNotFound ){
332
+ if ([self isSimulator ] ){
325
333
326
334
CGSize size = CGSizeMake (720 , 1280 );
327
335
UIGraphicsBeginImageContextWithOptions (size, YES , 0 );
Original file line number Diff line number Diff line change 4
4
"type" : " git" ,
5
5
"url" : " https://github.com/lwansbrough/react-native-camera.git"
6
6
},
7
- "version" : " 0.3.2 " ,
7
+ "version" : " 0.3.3 " ,
8
8
"description" : " A Camera component for React Native. Also reads barcodes." ,
9
9
"main" : " Camera.ios.js" ,
10
10
"author" :
" Lochlan Wansbrough <[email protected] > (http://lwansbrough.com)" ,
You can’t perform that action at this time.
0 commit comments