Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6304] Snapshotter.takeSnapshot get error

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labels7.5.0.GA, 8.0.0.GA, 8.2.0.GA, iOS, snapshotter, takesnapshot
ReporterLorenzo Piccinini
AssigneeShak Hossain
Created2019-07-08T11:52:25.000+0000
Updated2019-11-05T18:13:53.000+0000

Description

Hello, I'm using Snapshotter.takeSnapshot to get snapshot of map. Sometimes it get in callback error, but there isn't a way to understand why, no error in console, no data in "e" callback's param. Since Snapshotter.takeSnapshot goes wrong it doesn't work until I restart the app. How to debug it? How to understand the problem?
Snapshotter.takeSnapshot({
  success: function(e) {
    Ti.API.info('Snapshotter success');
  },
  error: function(e) {
    Ti.API.error('Snapshotter error: ' + JSON.stringify(e));
  }
});

Comments

  1. Sharif AbuDarda 2019-07-12

    Hello, What callback error you see in the display? Can you send the full reproducible sample code that you are trying? The documented sample code in https://docs.appcelerator.com/platform/latest/#!/api/Modules.Map.Snapshotter works just fine in iOS with the latest SDK. Run also a trace log of your project from the terminal and send the log that shows the error. Thanks.
  2. Lorenzo Piccinini 2019-07-14

    The error function return undefined error, "e" is undefined. Impossibile to understand the problem, I don't know why sometimes it get error. Explain to me how I can help you understand the problem.
       Snapshotter.takeSnapshot({
         success: function(e) {
           Ti.API.info('Snapshotter success');
         },
         error: function(e) {
           // here "e" is undefined
         }
       });
       
  3. Rakhi Mitro 2019-07-16

    [~otto.pic], Thanks for your feedback. Can you please share a simple test case to reproduce the issue on our end?
  4. Lorenzo Piccinini 2019-07-16

    This is part of my code, the problem is that I haven't found a way to reproduce the error. I noticed from my email debug reports that it happens to my users 2-3 times a day on production version. It happened to me once by replacing the testflight version with the production one, but as I already wrote e.error is undefined and I didn't understand the cause.
       
       var Map = require('ti.map');
       
       var win = Ti.UI.createWindow({
       	title: L('position'),
       	layout: 'vertical',
       	backgroundColor: '#FFF',
       	barColor: '#FFF',
       	translucent: false
       });
       var setYourCurrentGPSPosition = Ti.UI.createButton({
       	top: 50,
       	width: 200,
       	height: 60,
       	title: 'SAVE'
       });
       win.add(setYourCurrentGPSPosition);
       
       setYourCurrentGPSPosition.addEventListener("click", function(e){
       
       	var dialog = Ti.UI.createAlertDialog({
       		title: L('positionTitle'),
       		style: Ti.UI.iOS.AlertDialogStyle.PLAIN_TEXT_INPUT,
       		buttonNames: ['OK']
       	  });
       
       	  dialog.addEventListener('click', function(e) {
       		setYourCurrentGPSPositionFunction();
       	  });
       
       	  dialog.show();
       
       	
       });
       
       var setYourCurrentGPSPositionFunction = function(){
       	
       	var Snapshotter = Map.createSnapshotter({
       		mapType: Map.HYBRID_FLYOVER_TYPE,
       		showBuildings: true,
       		showPointsOfInterest: true,
       		region: {
       			latitude: 37.3382,
       			longitude: -121.8863,
       			latitudeDelta: 0.01,
       			longitudeDelta: 0.01
       		},
       		size: {
       			width: 840,
       			height: 340
       		}
       	});
       	
       	Snapshotter.takeSnapshot({
       		success: function(e) {
       			alert('success');
       		},
       		error: function(e) {
       			alert(e.error);
       		}
       	});
       		
       };
       
       
       win.open();
       
  5. Rakhi Mitro 2019-08-08

    Hello [~otto.pic], We tested the sample code provided by you on IOS device (12.3.1) with SDK 8.0.2.GA and did not experience any callback error. It would be great if you can share exact test steps to reproduce the issue on our end.
  6. Lorenzo Piccinini 2019-08-08

    The problem is I can’t reproduce it, but I receive many errors from from production App, but as I wrote no data available in argument of error
  7. Jan Vennemann 2019-09-09

    [~otto.pic] since we couldn't reproduce this yet it is hard to tell what's going on. Did you try to call takeSnapshot again in case the unknown error case happens? Something like this:
       let tries = 0;
       const takeSnapshotOptions = {
         success: function(e) {
           alert('success');
         },
         error: function(e) {
           if (!e) {
             if (tries < 5) {
               tries++;
               Snapshotter.takeSnapshot(takeSnapshotOptions);
             } else {
               alert('An unknown error occured. Please try again.');
             }
           } else {
             alert(e.error)
           }
         }
       }
       Snapshotter.takeSnapshot(takeSnapshotOptions);
       
    Maybe this helps to workaround the unknown error.
  8. Lorenzo Piccinini 2019-09-09

    Thank you for your help, I'll try to recall takeSnapshot, I haven't tried it yet.
  9. Lorenzo Piccinini 2019-09-09

    I think I had tracked the crash with crashlytics by fabric, isn't it?
       #11. Crashed: com.twitter.crashlytics.ios.exception
       0  MyApp                      0x10220980c CLSProcessRecordAllThreads + 4310603788
       1  MyApp                      0x102209bf4 CLSProcessRecordAllThreads + 4310604788
       2  MyApp                      0x1021f9470 CLSHandler + 4310537328
       3  MyApp                      0x102207e04 __CLSExceptionRecord_block_invoke + 4310597124
       4  libdispatch.dylib              0x2017297d4 _dispatch_client_callout + 16
       5  libdispatch.dylib              0x2016d7c1c _dispatch_lane_barrier_sync_invoke_and_complete + 56
       6  MyApp                      0x102207870 CLSExceptionRecord + 4310595696
       7  MyApp                      0x10220769c CLSExceptionRecordNSException + 4310595228
       8  MyApp                      0x102207290 CLSTerminateHandler() + 4310594192
       9  libc++abi.dylib                0x200eb8838 std::__terminate(void (*)()) + 16
       10 libc++abi.dylib                0x200eb88c4 std::terminate() + 84
       11 libobjc.A.dylib                0x200ec3d5c _destroyAltHandlerList + 10
       12 libdispatch.dylib              0x2017297e8 _dispatch_client_callout + 36
       13 libdispatch.dylib              0x2016ce01c _dispatch_continuation_pop$VARIANT$mp + 412
       14 libdispatch.dylib              0x2016cd79c _dispatch_async_redirect_invoke + 788
       15 libdispatch.dylib              0x2016da030 _dispatch_root_queue_drain + 372
       16 libdispatch.dylib              0x2016da8d4 _dispatch_worker_thread2 + 128
       17 libsystem_pthread.dylib        0x20190a1b4 _pthread_wqthread + 464
       18 libsystem_pthread.dylib        0x20190ccd4 start_wqthread + 4
       
       --
       
       Fatal Exception: NSInvalidArgumentException
       0  CoreFoundation                 0x201cea98c __exceptionPreprocess
       1  libobjc.A.dylib                0x200ec39f8 objc_exception_throw
       2  CoreFoundation                 0x201c071c8 -[NSOrderedSet initWithSet:copyItems:]
       3  CoreFoundation                 0x201cf01d4 ___forwarding___
       4  CoreFoundation                 0x201cf1e6c _CF_forwarding_prep_0
       5  MyApp                      0x102214c00 -[ANSAttributeDictionary initWithDictionary:]
       6  MyApp                      0x10221e588 -[ANSCustomEvent attributesDictionary]
       7  MyApp                      0x10221e4a0 -[ANSCustomEvent dictionaryRepresentation]
       8  MyApp                      0x102218a7c -[ANSWriteEventOperation generateFormattedLogLineWithEvent:]
       9  MyApp                      0x102218368 -[ANSWriteEventOperation initWithEvent:metadata:logFileUrl:]
       10 MyApp                      0x10222133c __37-[ANSAnswersController enqueueEvent:]_block_invoke
       11 Foundation                     0x20274fec8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
       12 Foundation                     0x20265c2e0 -[NSBlockOperation main]
       13 Foundation                     0x20265b7c8 -[__NSOperationInternal _start:]
       14 Foundation                     0x202751c4c __NSOQSchedule_f
       15 libdispatch.dylib              0x201728a38 _dispatch_call_block_and_release
       16 libdispatch.dylib              0x2017297d4 _dispatch_client_callout
       17 libdispatch.dylib              0x2016ce01c _dispatch_continuation_pop$VARIANT$mp
       18 libdispatch.dylib              0x2016cd79c _dispatch_async_redirect_invoke
       19 libdispatch.dylib              0x2016da030 _dispatch_root_queue_drain
       20 libdispatch.dylib              0x2016da8d4 _dispatch_worker_thread2
       21 libsystem_pthread.dylib        0x20190a1b4 _pthread_wqthread
       22 libsystem_pthread.dylib        0x20190ccd4 start_wqthread
       
       #0. com.apple.main-thread
       0  libsystem_kernel.dylib         0x20187c0f4 mach_msg_trap + 8
       1  libsystem_kernel.dylib         0x20187b5a0 mach_msg + 72
       2  CoreFoundation                 0x201c7c120 __CFRunLoopServiceMachPort + 236
       3  CoreFoundation                 0x201c77030 __CFRunLoopRun + 1360
       4  CoreFoundation                 0x201c767c0 CFRunLoopRunSpecific + 436
       5  GraphicsServices               0x203e7779c GSEventRunModal + 104
       6  UIKitCore                      0x22e5f5c38 UIApplicationMain + 212
       7  MyApp                      0x102132f10 main + 69 (main.m:69)
       8  libdyld.dylib                  0x20173a8e0 start + 4
       
       #1. com.apple.uikit.eventfetch-thread
       0  libsystem_kernel.dylib         0x20187c0f4 mach_msg_trap + 8
       1  libsystem_kernel.dylib         0x20187b5a0 mach_msg + 72
       2  CoreFoundation                 0x201c7c120 __CFRunLoopServiceMachPort + 236
       3  CoreFoundation                 0x201c77030 __CFRunLoopRun + 1360
       4  CoreFoundation                 0x201c767c0 CFRunLoopRunSpecific + 436
       5  Foundation                     0x202644eac -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
       6  Foundation                     0x202644d3c -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
       7  UIKitCore                      0x22e6db754 -[UIEventFetcher threadMain] + 136
       8  Foundation                     0x202771674 __NSThread__start__ + 984
       9  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       10 libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       11 libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #2. JavaScriptCore bmalloc scavenger
       0  libsystem_kernel.dylib         0x201886ee4 __psynch_cvwait + 8
       1  libsystem_pthread.dylib        0x201901cf8 _pthread_cond_wait$VARIANT$mp + 636
       2  libc++.1.dylib                 0x200e5d090 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
       3  JavaScriptCore                 0x208f0ade0 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 108
       4  JavaScriptCore                 0x208f0edd4 bmalloc::Scavenger::threadRunLoop() + 176
       5  JavaScriptCore                 0x208f0e54c bmalloc::Scavenger::Scavenger(std::__1::lock_guard<bmalloc::Mutex>&) + 10
       6  JavaScriptCore                 0x208f0ff8c std::__1::__thread_specific_ptr<std::__1::__thread_struct>::set_pointer(std::__1::__thread_struct*) + 38
       7  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       8  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       9  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #3. com.twitter.crashlytics.ios.MachExceptionServer
       0  libsystem_kernel.dylib         0x20187c0f4 mach_msg_trap + 8
       1  libsystem_kernel.dylib         0x20187b5a0 mach_msg + 72
       2  MyApp                      0x1021f443c CLSMachExceptionServer + 4310516796
       3  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       4  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       5  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #4. com.apple.NSURLConnectionLoader
       0  libsystem_kernel.dylib         0x20187c0f4 mach_msg_trap + 8
       1  libsystem_kernel.dylib         0x20187b5a0 mach_msg + 72
       2  CoreFoundation                 0x201c7c120 __CFRunLoopServiceMachPort + 236
       3  CoreFoundation                 0x201c77030 __CFRunLoopRun + 1360
       4  CoreFoundation                 0x201c767c0 CFRunLoopRunSpecific + 436
       5  CFNetwork                      0x20229074c -[__CoreSchedulingSetRunnable runForever] + 216
       6  Foundation                     0x202771674 __NSThread__start__ + 984
       7  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       8  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       9  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #5. Thread
       0  libsystem_kernel.dylib         0x201887b74 __workq_kernreturn + 8
       1  libsystem_pthread.dylib        0x20190a138 _pthread_wqthread + 340
       2  libsystem_pthread.dylib        0x20190ccd4 start_wqthread + 4
       
       #6. Thread
       0  libsystem_pthread.dylib        0x20190ccd0 start_wqthread + 190
       
       #7. hardwareJPEGQueue/workers/worker0
       0  libsystem_kernel.dylib         0x201886ee4 __psynch_cvwait + 8
       1  libsystem_pthread.dylib        0x201901cf8 _pthread_cond_wait$VARIANT$mp + 636
       2  VectorKit                      0x21215a25c karo::Worker::threadMain() + 572
       3  VectorKit                      0x2121e5018 karo::Thread::callback(void*) + 72
       4  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       5  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       6  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #8. hardwareJPEGQueue/workers/worker1
       0  libsystem_kernel.dylib         0x201886ee4 __psynch_cvwait + 8
       1  libsystem_pthread.dylib        0x201901cf8 _pthread_cond_wait$VARIANT$mp + 636
       2  VectorKit                      0x21215a25c karo::Worker::threadMain() + 572
       3  VectorKit                      0x2121e5018 karo::Thread::callback(void*) + 72
       4  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       5  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       6  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #9. diskQueue/workers/worker0
       0  libsystem_kernel.dylib         0x201886ee4 __psynch_cvwait + 8
       1  libsystem_pthread.dylib        0x201901cf8 _pthread_cond_wait$VARIANT$mp + 636
       2  VectorKit                      0x21215a25c karo::Worker::threadMain() + 572
       3  VectorKit                      0x2121e5018 karo::Thread::callback(void*) + 72
       4  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       5  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       6  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #10. processingQueue/workers/worker0
       0  libsystem_kernel.dylib         0x201886ee4 __psynch_cvwait + 8
       1  libsystem_pthread.dylib        0x201901cf8 _pthread_cond_wait$VARIANT$mp + 636
       2  VectorKit                      0x21215a25c karo::Worker::threadMain() + 572
       3  VectorKit                      0x2121e5018 karo::Thread::callback(void*) + 72
       4  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       5  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       6  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #11. Crashed: com.twitter.crashlytics.ios.exception
       0  MyApp                      0x10220980c CLSProcessRecordAllThreads + 4310603788
       1  MyApp                      0x102209bf4 CLSProcessRecordAllThreads + 4310604788
       2  MyApp                      0x1021f9470 CLSHandler + 4310537328
       3  MyApp                      0x102207e04 __CLSExceptionRecord_block_invoke + 4310597124
       4  libdispatch.dylib              0x2017297d4 _dispatch_client_callout + 16
       5  libdispatch.dylib              0x2016d7c1c _dispatch_lane_barrier_sync_invoke_and_complete + 56
       6  MyApp                      0x102207870 CLSExceptionRecord + 4310595696
       7  MyApp                      0x10220769c CLSExceptionRecordNSException + 4310595228
       8  MyApp                      0x102207290 CLSTerminateHandler() + 4310594192
       9  libc++abi.dylib                0x200eb8838 std::__terminate(void (*)()) + 16
       10 libc++abi.dylib                0x200eb88c4 std::terminate() + 84
       11 libobjc.A.dylib                0x200ec3d5c _destroyAltHandlerList + 10
       12 libdispatch.dylib              0x2017297e8 _dispatch_client_callout + 36
       13 libdispatch.dylib              0x2016ce01c _dispatch_continuation_pop$VARIANT$mp + 412
       14 libdispatch.dylib              0x2016cd79c _dispatch_async_redirect_invoke + 788
       15 libdispatch.dylib              0x2016da030 _dispatch_root_queue_drain + 372
       16 libdispatch.dylib              0x2016da8d4 _dispatch_worker_thread2 + 128
       17 libsystem_pthread.dylib        0x20190a1b4 _pthread_wqthread + 464
       18 libsystem_pthread.dylib        0x20190ccd4 start_wqthread + 4
       
       #12. Thread
       0  libsystem_pthread.dylib        0x20190ccd0 start_wqthread + 190
       
       #13. com.apple.vectorkit.dispatch.layoutqueue
       0  libsystem_kernel.dylib         0x20187c148 semaphore_timedwait_trap + 8
       1  libdispatch.dylib              0x2016cb888 _dispatch_sema4_timedwait$VARIANT$mp + 64
       2  libdispatch.dylib              0x2016cc1dc _dispatch_semaphore_wait_slow + 72
       3  libdispatch.dylib              0x2016d9df8 _dispatch_worker_thread + 352
       4  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       5  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       6  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #14. com.apple.vectorkit.dispatch.renderqueue
       0  libsystem_kernel.dylib         0x20187c148 semaphore_timedwait_trap + 8
       1  libdispatch.dylib              0x2016cb888 _dispatch_sema4_timedwait$VARIANT$mp + 64
       2  libdispatch.dylib              0x2016cc1dc _dispatch_semaphore_wait_slow + 72
       3  libdispatch.dylib              0x2016d9df8 _dispatch_worker_thread + 352
       4  libsystem_pthread.dylib        0x2019092c0 _pthread_body + 128
       5  libsystem_pthread.dylib        0x201909220 _pthread_start + 44
       6  libsystem_pthread.dylib        0x20190ccdc thread_start + 4
       
       #15. Thread
       0  libsystem_pthread.dylib        0x20190ccd0 start_wqthread + 190
       
       #16. Thread
       0  libsystem_pthread.dylib        0x20190ccd0 start_wqthread + 190
       
       #17. Thread
       0  libsystem_kernel.dylib         0x201887b74 __workq_kernreturn + 8
       1  libsystem_pthread.dylib        0x20190a138 _pthread_wqthread + 340
       2  libsystem_pthread.dylib        0x20190ccd4 start_wqthread + 4
       
  10. Lorenzo Piccinini 2019-09-17

    Can anyone check this problem?
  11. Lorenzo Piccinini 2019-09-27

    8.2.0.GA affected too. It's very big problem for me, many users get bud service interruption.
  12. Jan Vennemann 2019-09-27

    [~otto.pic], have you tried recalling takeSnapshot as i suggest in my previous comment? The crash report you provided unfortunately doesn't help much since it indicates a crash in crashlytics itself whily trying to log an event. And as i understand from your previous notes, the issue you were seeing didn't result in a crash anyway, right?
  13. Lorenzo Piccinini 2019-09-27

    @Jan Vennemann, I have implemented and published the racalling ok takeSnapshot but it don't solve the problem. No, the result is not crash of ap, so it isn't logged. When takeSnapshot take error I have to ask to user to kill the app and reopen it to solve the problem. How can help you to debug this problem?

JSON Source