tetujin / aware-client-ios

http://awareframework.com
13 stars 12 forks source link

QRCode Button #1

Closed luiscruz closed 8 years ago

luiscruz commented 8 years ago

When running the app on the simulator (iPhone 6s) and pressing QRCode the app crashes.

This is the output: 2016-02-15 16:54:02.102 AWARE[985:434127] Hello ESM view ! 2016-02-15 16:54:02.119 AWARE[985:434127] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Can't add a nil AVCaptureInput' *** First throw call stack: ( 0 CoreFoundation 0x0000000105c51e65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x00000001095b9deb objc_exception_throw + 48 2 AVFoundation 0x00000001092e37fa -[AVCaptureSession _addInputWithNoConnections:] + 794 3 AVFoundation 0x00000001092e31a9 -[AVCaptureSession addInput:] + 96 4 AWARE 0x0000000104be4310 -[QRCodeViewController viewDidLoad] + 992 5 UIKit 0x0000000106faff98 -[UIViewController loadViewIfRequired] + 1198 6 UIKit 0x0000000106fb5f4f -[UIViewController __viewWillAppear:] + 120 7 UIKit 0x0000000106fe5e44 -[UINavigationController _startCustomTransition:] + 1203 8 UIKit 0x0000000106ff623f -[UINavigationController _startDeferredTransitionIfNeeded:] + 712 9 UIKit 0x0000000106ff73af -[UINavigationController __viewWillLayoutSubviews] + 57 10 UIKit 0x000000010719dff7 -[UILayoutContainerView layoutSubviews] + 248 11 UIKit 0x0000000106ed04a3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703 12 QuartzCore 0x000000010cf0959a -[CALayer layoutSublayers] + 146 13 QuartzCore 0x000000010cefde70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 14 QuartzCore 0x000000010cefdcee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x000000010cef2475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 16 QuartzCore 0x000000010cf1fc0a _ZN2CA11Transaction6commitEv + 486 17 QuartzCore 0x000000010cf2037c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 18 CoreFoundation 0x0000000105b7d367 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 19 CoreFoundation 0x0000000105b7d2d7 __CFRunLoopDoObservers + 391 20 CoreFoundation 0x0000000105b72f2b __CFRunLoopRun + 1147 21 CoreFoundation 0x0000000105b72828 CFRunLoopRunSpecific + 488 22 GraphicsServices 0x000000010a97bad2 GSEventRunModal + 161 23 UIKit 0x0000000106e19610 UIApplicationMain + 171 24 AWARE 0x0000000104c231af main + 111 25 libdyld.dylib 0x0000000109b5592d start + 1 26 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

tetujin commented 8 years ago

Hi, @luiscruz.

Thank you for your comment. I fixed the bug and pushed the latest source code.

The reason of the bug is that the app initializes an AVCaptureSession with a nil value (AVCaptureDeviceInput). iOS simulators don't support camera APIs, therefore, the app got an AVCaptureDeviceInput as a nil value.

And also, you should write a study URL directly for downloading a study configuration without the QRcode reader if you test an AWARE iOS on a simulator. Please add the following source code to the "-(IBAction)pushedStudyRefreshButton:(id)sender" method on the ViewController.m.

// === A test code for a simulator ===
AWAREStudy *awareStudy = [[AWAREStudy alloc] init];
[awareStudy setStudyInformationWithURL:@"https://api.awareframework.com/index.php/webservice/index/[Study ID][API key]/"];
// =================================

Best regards,

-- Yuuki

luiscruz commented 8 years ago

Fixed :+1: thanks!

Although I have added the line you suggested (after changing it with my study URL), the device is not appearing when I check my dashboard. Probably the emulator is not the best environment to test this app, but I am still struggling with having the app running in my phone (provisioning profile issues, I believe).