viezel/TiSocial.Framework

should have a non-nil sourceView or barButtonItem set before the presentation occurs

Opened this issue · 5 comments

abada commented

Ipad Popover not working

[ERROR] :  The application has crashed with an uncaught exception 'NSGenericException'.
[ERROR] :  Reason:
[ERROR] :  UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x79970f20>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.
[ERROR] :  Stack trace:
[ERROR] :  
[ERROR] :  0   CoreFoundation                      0x05937a78 __exceptionPreprocess + 152
[ERROR] :  1   libobjc.A.dylib                     0x05353e02 objc_exception_throw + 50
[ERROR] :  2   UIKit                               0x02ac7d9a -[UIPopoverPresentationController presentationTransitionWillBegin] + 3956
[ERROR] :  3   UIKit                               0x021cd19f __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2264
[ERROR] :  4   UIKit                               0x021ca9ee __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 333
[ERROR] :  5   UIKit                               0x0220d02f __40+[UIViewController _scheduleTransition:]_block_invoke + 18
[ERROR] :  6   UIKit                               0x0204837b _runAfterCACommitDeferredBlocks + 337
[ERROR] :  7   UIKit                               0x0205c839 _cleanUpAfterCAFlushAndRunDeferredBlocks + 103
[ERROR] :  8   UIKit                               0x0206a4db _afterCACommitHandler + 102
[ERROR] :  9   CoreFoundation                      0x0585177e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
[ERROR] :  10  CoreFoundation                      0x058516de __CFRunLoopDoObservers + 398
[ERROR] :  11  CoreFoundation                      0x0584705c __CFRunLoopRun + 1340
[ERROR] :  12  CoreFoundation                      0x05846866 CFRunLoopRunSpecific + 470
[ERROR] :  13  CoreFoundation                      0x0584667b CFRunLoopRunInMode + 123
[ERROR] :  14  GraphicsServices                    0x065b7664 GSEventRunModal + 192
[ERROR] :  15  GraphicsServices                    0x065b74a1 GSEventRun + 104
[ERROR] :  16  UIKit                               0x0203acc1 UIApplicationMain + 160
[ERROR] :  17  Prophet as husband                  0x000a9e98 main + 408
[ERROR] :  18  libdyld.dylib                       0x0929ca21 start + 1
[ERROR] :  
[ERROR] :  2015-10-27 15:06:49.699 Prophet as husband[27101:106019] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x79970f20>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
[ERROR] :  *** First throw call stack:
[ERROR] :  (
[ERROR] :   0   CoreFoundation                      0x05937a94 __exceptionPreprocess + 180
[ERROR] :   1   libobjc.A.dylib                     0x05353e02 objc_exception_throw + 50
[ERROR] :   2   UIKit                               0x02ac7d9a -[UIPopoverPresentationController presentationTransitionWillBegin] + 3956
[ERROR] :   3   UIKit                               0x021cd19f __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 2264
[ERROR] :   4   UIKit                               0x021ca9ee __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 333
[ERROR] :   5   UIKit                               0x0220d02f __40+[UIViewController _scheduleTransition:]_block_invoke + 18
[ERROR] :   6   UIKit                               0x0204837b _runAfterCACommitDeferredBlocks + 337
[ERROR] :   7   UIKit                               0x0205c839 _cleanUpAfterCAFlushAndRunDeferredBlocks + 103
[ERROR] :   8   UIKit                               0x0206a4db _afterCACommitHandler + 102
[ERROR] :   9   CoreFoundation                      0x0585177e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
[ERROR] :   10  CoreFoundation                      0x058516de __CFRunLoopDoObservers + 398
[ERROR] :   11  CoreFoundation                      0x0584705c __CFRunLoopRun + 1340
[ERROR] :   12  CoreFoundation                      0x05846866 CFRunLoopRunSpecific + 470
[ERROR] :   13  CoreFoundation                      0x0584667b CFRunLoopRunInMode + 123
[ERROR] :   14  GraphicsServices                    0x065b7664 GSEventRunModal + 192
[ERROR] :   15  GraphicsServices                    0x065b74a1 GSEventRun + 104
[ERROR] :   16  UIKit                               0x0203acc1 UIApplicationMain + 160
[ERROR] :   17  Prophet as husband                  0x000a9e98 main + 408
[ERROR] :   18  libdyld.dylib                       0x0929ca21 start + 1
[ERROR] :  )
[ERROR] :  libc++abi.dylib: terminating with uncaught exception of type NSException

can you fix that in a PR? I'm waiting for a solution for that very long

I just fixed this by using Social.activityPopover instead of Social.activityView on the iPad and passing a view: theButton to it.

"theButton" has to be a valid TiUIButton or TiUIView element. If you trigger the activitiyPopover with a click event, "event.source" will do it

var button = Ti.UI.createButton({title: 'Share!'});
button.addEventListener('click', function(e) {
  Social.activityPopover({view: e.source, ...);
});
win.add(button);
abada commented

@lowb1rd

Not working :(

@abada Please check the latest v1.8.4 update and close this issue if its fixed.

abada commented

Thank you i will try