dk.napp.social 1.7.10 / SDK 3.5.0 / iPad (iPhone works well) --> Crashes
Closed this issue · 13 comments
Using dk.napp.social 1.7.10 / SDK 3.5.0 / iPad, the app crashes and the Titanium console gives me the following error (everything works perfect on iPhone):
[ERROR] : The application has crashed with an uncaught exception 'NSGenericException'.
[ERROR] : Reason:
[ERROR] : UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7a732300>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x051d892a __exceptionPreprocess + 154
[ERROR] : 1 libobjc.A.dylib 0x04daaa97 objc_exception_throw + 44
[ERROR] : 2 UIKit 0x014c7e47 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3086
[ERROR] : 3 UIKit 0x00dca385 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1666
[ERROR] : 4 UIKit 0x00dc8968 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 226
[ERROR] : 5 UIKit 0x00dfc7ab __40+[UIViewController _scheduleTransition:]_block_invoke + 18
[ERROR] : 6 UIKit 0x00cc20ce ___afterCACommitHandler_block_invoke + 15
[ERROR] : 7 UIKit 0x00cc2079 _applyBlockToCFArrayCopiedToStack + 415
[ERROR] : 8 UIKit 0x00cc1e8e _afterCACommitHandler + 545
[ERROR] : 9 CoreFoundation 0x050fb9de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
[ERROR] : 10 CoreFoundation 0x050fb920 __CFRunLoopDoObservers + 400
[ERROR] : 11 CoreFoundation 0x050f135a __CFRunLoopRun + 1226
[ERROR] : 12 CoreFoundation 0x050f0bcb CFRunLoopRunSpecific + 443
[ERROR] : 13 CoreFoundation 0x050f09fb CFRunLoopRunInMode + 123
[ERROR] : 14 GraphicsServices 0x055b724f GSEventRunModal + 192
[ERROR] : 15 GraphicsServices 0x055b708c GSEventRun + 104
[ERROR] : 16 UIKit 0x00c988b6 UIApplicationMain + 1526
[ERROR] : 17 AppName 0x000450b8 main + 456
[ERROR] : 18 libdyld.dylib 0x08061ac9 start + 1
[ERROR] :
[ERROR] : 2015-03-03 21:53:29.866 AppName[14536:16722114] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7a732300>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
[ERROR] : *** First throw call stack:
[ERROR] : (
[ERROR] : 0 CoreFoundation 0x051d8946 __exceptionPreprocess + 182
[ERROR] : 1 libobjc.A.dylib 0x04daaa97 objc_exception_throw + 44
[ERROR] : 2 UIKit 0x014c7e47 -[UIPopoverPresentationController presentationTransitionWillBegin] + 3086
[ERROR] : 3 UIKit 0x00dca385 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1666
[ERROR] : 4 UIKit 0x00dc8968 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 226
[ERROR] : 5 UIKit 0x00dfc7ab __40+[UIViewController _scheduleTransition:]_block_invoke + 18
[ERROR] : 6 UIKit 0x00cc20ce ___afterCACommitHandler_block_invoke + 15
[ERROR] : 7 UIKit 0x00cc2079 _applyBlockToCFArrayCopiedToStack + 415
[ERROR] : 8 UIKit 0x00cc1e8e _afterCACommitHandler + 545
[ERROR] : 9 CoreFoundation 0x050fb9de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
[ERROR] : 10 CoreFoundation 0x050fb920 __CFRunLoopDoObservers + 400
[ERROR] : 11 CoreFoundation 0x050f135a __CFRunLoopRun + 1226
[ERROR] : 12 CoreFoundation 0x050f0bcb CFRunLoopRunSpecific + 443
[ERROR] : 13 CoreFoundation 0x050f09fb CFRunLoopRunInMode + 123
[ERROR] : 14 GraphicsServices 0x055b724f GSEventRunModal + 192
[ERROR] : 15 GraphicsServices 0x055b708c GSEventRun + 104
[ERROR] : 16 UIKit 0x00c988b6 UIApplicationMain + 1526
[ERROR] : 17 AppName 0x000450b8 main + 456
[ERROR] : 18 libdyld.dylib 0x08061ac9 start + 1
[ERROR] : )
[ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException
I'm getting the same error.
iOS Simulator Tests:
Tested dk.napp.social 1.7.9 / SDK 3.5.0 / iPad Air (v8.1) - Result App Crash and Error
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad Air (v8.1) - Result App Crash and Error
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad 2 (v8.1) - Result App Crash and Error
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad Retina (v8.1) - Result App Crash and Error
Tested dk.napp.social 1.7.10 / SDK 3.5.1 / iPad Air (v8.1) - Result App Crash and Error
Real Device Test:
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad Mini (v8.1) - Result App Crash and Error
However iOS 7.1 works perfectly:
Tested dk.napp.social 1.7.9 / SDK 3.5.0 / iPad Air (v7.1) - Result Works perfectly like the iPhone
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad Air (v7.1) - Result Works perfectly like the iPhone
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad 2 (v7.1) - Result Works perfectly like the iPhone
Tested dk.napp.social 1.7.10 / SDK 3.5.0 / iPad Retina (v7.1) - Result Works perfectly like the iPhone
Tested dk.napp.social 1.7.10 / SDK 3.5.1 / iPad Air (v7.1) - Result Works perfectly like the iPhone
Would seem that the issue has to do with iOS 8.x and the iPad, what the solution is, is a little above my knowledge base.
Hopefully this information helps with a solution we can all apply.
Can you share some code that caused the error?
Sure no problem, the easiest example i can think of would be using the "example" code https://github.com/ludolphus/TiSocial.Framework/tree/master/example.
The Project Setup:
I know the below might be over kill with my step by step, however maybe i am and other are doing it wrong
Creating a new clean project in Titanium Classic, then copying the example folder files.
Then Adding the module, which i did by using Titanium --> Help --> Install Mobile Module,
Output Location Titanium SDK and selecting the dk.napp.social-iphone-1.7.10.zip in the dost folder to install. Installation of the Module works.
Then adding it to my project using the tiapp.xml overview clicking the + under Modules.
dk.napp.social i have selected iOS * [latest].
Then made doubly sure it was active looking at the tiapp.xml
dk.napp.social
The Testing Environment: dk.napp.social 1.7.10 / SDK 3.5.0 / example project / iOS Simulator
How-to test and cause the error and App crash:
After the App opens:
Click on Activity View "activitybtn.addEventListener("click", function()"
OR
Click on Custom Activity View " customactivitybtn.addEventListener("click", function()"
Device Test: iPad Air (v7.1) / iPad 2 (v7.1)
Result of click Activity View = Opens Dialog Box with Mail, Save Image, Assign to Contact, Copy, Print
Result of click Custom Activity View = Opens Dialog Box with Custom Share, Open in Safari
Device Test: iPad Air (v8.1) / iPad 2 (v8.1)
Result of click Activity View = App Crash and Error
Result of click Custom Activity View = App Crash and Error
Build and Error Log:
Titanium SDK
SDK Version = 3.5.0.GA
SDK Path = /Users/roysinclair/Library/Application Support/Titanium/mobilesdk/osx/3.5.0.GA
Target Platform = iphone
Command
/usr/local/bin/node /usr/local/bin/titanium --no-colors --no-progress-bars --no-prompt build --platform ipad --log-level trace --sdk 3.5.0.GA --project-dir /Users/roysinclair/Documents/Titanium_Studio_Workspace/example sharing --target simulator --ios-version 8.1 --device-family universal --deploy-type development --sim-type ipad --sim-version 8.1 --device-id 46991D1D-221E-4D14-9F5E-7CC3F0CE98FE --skip-js-minify --skip-js-minify
[INFO] : Found Titanium module id=dk.napp.social version=1.7.10 platform=iphone deploy-type=development path=/Users/roysinclair/Library/Application Support/Titanium/modules/iphone/dk.napp.social/1.7.10
[INFO] : Deploy type: development
[INFO] : Building for target: simulator
[INFO] : Building using iOS SDK: 8.1
[INFO] : Building for iOS Simulator: iPad Air
[INFO] : Building for device family: universal
[INFO] : Minimum iOS version: 7.0
[INFO] : Debugging disabled
[INFO] : Profiler disabled
[INFO] : Forcing rebuild: modules hash changed since last build
[INFO] : Was: 435d6ae96f6d113805f05f19799da0cb
[INFO] : Now: faf7b801ec4c2e0c31821345ae3cb7bb
[INFO] : Initiating prepare phase
[INFO] : Cleaning old build directory
[INFO] : Performing full rebuild
[INFO] : Copying Xcode iOS files
[INFO] : Creating Xcode project directory: /Users/roysinclair/Documents/Titanium_Studio_Workspace/example sharing/build/iphone/example sharing.xcodeproj
[INFO] : Writing Xcode project data file: Titanium.xcodeproj/project.pbxproj
[INFO] : Writing Xcode project configuration: project.xcconfig
[INFO] : Writing Xcode module configuration: module.xcconfig
[INFO] : Injecting native libraries into Xcode project file
[INFO] : Forcing rebuild: ApplicationDefaults.m has changed since last build
[INFO] : Writing application defaults: /Users/roysinclair/Documents/Titanium_Studio_Workspace/example sharing/build/iphone/Classes/ApplicationDefaults.m
[INFO] : Initiating Xcode pre-compile phase
[INFO] : Processing JavaScript files
[INFO] : Processing Titanium namespace resources
[INFO] : Invoking xcodebuild
[INFO] : Finished building the application in 35s 610ms
[INFO] : Launching iOS Simulator
[INFO] : Project built successfully in 1m 1s 388ms
-- Start simulator log -------------------------------------------------------
[INFO] : Application started
[INFO] : example sharing/1.0 (3.5.0.0014f83)
[INFO] : [object DkNappSocialModule] loaded
[INFO] : module is => [object DkNappSocialModule]
[INFO] : Facebook available: false
[INFO] : Twitter available: false
[INFO] : SinaWeibo available: false
[ERROR] : The application has crashed with an uncaught exception 'NSGenericException'.
[ERROR] : Reason:
[ERROR] : UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7f8be1cc1a00>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x0000000109708f1d __exceptionPreprocess + 141
[ERROR] : 1 libobjc.A.dylib 0x00000001092e0bb7 objc_exception_throw + 45
[ERROR] : 2 UIKit 0x0000000106414fdf -[UIPopoverPresentationController presentationTransitionWillBegin] + 2650
[ERROR] : 3 UIKit 0x0000000105dfb0a7 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1398
[ERROR] : 4 UIKit 0x0000000105df9b50 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 175
[ERROR] : 5 UIKit 0x0000000105d19331 _applyBlockToCFArrayCopiedToStack + 314
[ERROR] : 6 UIKit 0x0000000105d191ab _afterCACommitHandler + 516
[ERROR] : 7 CoreFoundation 0x000000010963ddc7 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
[ERROR] : 8 CoreFoundation 0x000000010963dd20 **CFRunLoopDoObservers + 368
[ERROR] : 9 CoreFoundation 0x0000000109633b53 __CFRunLoopRun + 1123
[ERROR] : 10 CoreFoundation 0x0000000109633486 CFRunLoopRunSpecific + 470
[ERROR] : 11 GraphicsServices 0x0000000109b249f0 GSEventRunModal + 161
[ERROR] : 12 UIKit 0x0000000105cf6420 UIApplicationMain + 1282
[ERROR] : 13 example sharing 0x00000001041f3e19 main + 393
[ERROR] : 14 libdyld.dylib 0x000000010c854145 start + 1
[ERROR] : 15 ??? 0x0000000000000001 0x0 + 1
[ERROR] :
[ERROR] : 2015-03-12 12:28:14.304 example sharing[77793:492676] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7f8be1cc1a00>) should have a non-nil sourceView or barButtonItem set before the presentation occurs.'
[ERROR] : * First throw call stack:
[ERROR] : (
[ERROR] : 0 CoreFoundation 0x0000000109708f35 __exceptionPreprocess + 165
[ERROR] : 1 libobjc.A.dylib 0x00000001092e0bb7 objc_exception_throw + 45
[ERROR] : 2 UIKit 0x0000000106414fdf -[UIPopoverPresentationController presentationTransitionWillBegin] + 2650
[ERROR] : 3 UIKit 0x0000000105dfb0a7 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke + 1398
[ERROR] : 4 UIKit 0x0000000105df9b50 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 175
[ERROR] : 5 UIKit 0x0000000105d19331 _applyBlockToCFArrayCopiedToStack + 314
[ERROR] : 6 UIKit 0x0000000105d191ab _afterCACommitHandler + 516
[ERROR] : 7 CoreFoundation 0x000000010963ddc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
[ERROR] : 8 CoreFoundation 0x000000010963dd20 __CFRunLoopDoObservers + 368
[ERROR] : 9 CoreFoundation 0x0000000109633b53 __CFRunLoopRun + 1123
[ERROR] : 10 CoreFoundation 0x0000000109633486 CFRunLoopRunSpecific + 470
[ERROR] : 11 GraphicsServices 0x0000000109b249f0 GSEventRunModal + 161
[ERROR] : 12 UIKit 0x0000000105cf6420 UIApplicationMain + 1282
[ERROR] : 13 example sharing 0x00000001041f3e19 main + 393
[ERROR] : 14 libdyld.dylib 0x000000010c854145 start + 1
[ERROR] : 15 ??? 0x0000000000000001 0x0 + 1
[ERROR] : )
[ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException
So... you're trying to use the non-iPad methods on the iPad?
Well, I have not changes anything in my code. But maybe there's a change in the new version of iOS or TiSocial.Framework? I don't know Objective-C or Cocoa, so it's a bit tricky to understand the error output.
be sure to use Social.activityPopover() for iPad and Social.activityView() for iPhone
Thanks @ludolphus, problem solved!
Hi all,
I'm using Social Share Alloy Widget (https://github.com/ricardoalcocer/socialshare) based on dk.napp.social and I'm getting the same error.
So I replaced the following instruction in com.alcoapps.socialshare.js:
Social.activityView(payload);
with:
if (Ti.Platform.osname == "iphone") { Social.activityView(payload); } if (Ti.Platform.osname == "ipad") { Social.activityPopover(payload); } but now I get the following error:You must specify a source button - property: view
Can you help me?
Thank you,
Alex
I updated the SocialShare widget for Popover support. Thanks for reporting this!
What if you need to activate the share dialog when clicking on an icon in a listView? Can't seem to point to a view then...any solution/method?
@al3xr3a i had the same issue, i found that when calling the share method i had to include a view for the popover on an iPad.
socialWidget.share({ view: $.viewToPopOver, status: ....});
This error still seems to be happening if you run the following code on a iPad Air 2 simulator.
var Social = require('dk.napp.social');
if (Social.isActivityViewSupported()) {
if (Ti.Platform.osname == "ipad") {
Social.activityPopover({
view: $.openIpad,
text: address,
url: "http://example.com"
});
}
} else {
}
~~
Crash log
[ERROR] : The application has crashed with an uncaught exception 'NSInvalidArgumentException'.
[ERROR] : Reason:
[ERROR] : -[TiUIButtonProxy viewForPresenting]: unrecognized selector sent to instance 0x7f87730e5000
[ERROR] : Stack trace:
[ERROR] :
[ERROR] : 0 CoreFoundation 0x000000010e035f4d exceptionPreprocess + 141
[ERROR] : 1 libobjc.A.dylib 0x000000010da08deb objc_exception_throw + 48
[ERROR] : 2 CoreFoundation 0x000000010e03e58d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[ERROR] : 3 CoreFoundation 0x000000010df8bf7a ___forwarding + 970
[ERROR] : 4 CoreFoundation 0x000000010df8bb28 _CF_forwarding_prep_0 + 120
[ERROR] : 5 UIKit 0x000000010b214296 -[UIPopoverPresentationController _sourceView] + 55
[ERROR] : 6 UIKit 0x000000010b2125d9 -[UIPopoverPresentationController _initialPresentationViewControllerForViewController:] + 95
[ERROR] : 7 UIKit 0x000000010aa42909 -[UIViewController _modalPresenterForPresentationController:] + 55
[ERROR] : 8 UIKit 0x000000010aa50191 -[UIViewController _presentViewController:withAnimationController:completion:] + 2855
[ERROR] : 9 UIKit 0x000000010b265c46 -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 300
[ERROR] : 10 UIKit 0x000000010b2624a6 -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 149
[ERROR] : 11 UIKit 0x000000010b2621f9 -[_UIViewControllerTransitionContext completeTransition:] + 117
[ERROR] : 12 UIKit 0x000000010a958daa -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 644
[ERROR] : 13 UIKit 0x000000010a9373a7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241
[ERROR] : 14 UIKit 0x000000010a937756 -[UIViewAnimationState animationDidStop:finished:] + 80
[ERROR] : 15 QuartzCore 0x000000010cab4d70 _ZN2CA5Layer23run_animation_callbacksEPv + 308
[ERROR] : 16 libdispatch.dylib 0x000000010fe0d4a7 _dispatch_client_callout + 8
[ERROR] : 17 libdispatch.dylib 0x000000010fdf7fc9 _dispatch_main_queue_callback_4CF + 714
[ERROR] : 18 CoreFoundation 0x000000010df963e9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
[ERROR] : 19 CoreFoundation 0x000000010df57939 **CFRunLoopRun + 2073
[ERROR] : 20 CoreFoundation 0x000000010df56e98 CFRunLoopRunSpecific + 488
[ERROR] : 21 GraphicsServices 0x000000010fa5dad2 GSEventRunModal + 161
[ERROR] : 22 UIKit 0x000000010a8b2676 UIApplicationMain + 171
[ERROR] : 23 ShakeLocate 0x00000001083a5e16 main + 310
[ERROR] : 24 libdyld.dylib 0x000000010fe3c92d start + 1
[ERROR] : 25 ??? 0x0000000000000001 0x0 + 1
[ERROR] :
[ERROR] : 2015-11-10 20:31:53.419 ShakeLocate[29303:15184797] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TiUIButtonProxy _viewForPresenting]: unrecognized selector sent to instance 0x7f87730e5000'
[ERROR] : * First throw call stack:
[ERROR] : (
[ERROR] : 0 CoreFoundation 0x000000010e035f65 __exceptionPreprocess + 165
[ERROR] : 1 libobjc.A.dylib 0x000000010da08deb objc_exception_throw + 48
[ERROR] : 2 CoreFoundation 0x000000010e03e58d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
[ERROR] : 3 CoreFoundation 0x000000010df8bf7a __forwarding + 970
[ERROR] : 4 CoreFoundation 0x000000010df8bb28 _CF_forwarding_prep_0 + 120
[ERROR] : 5 UIKit 0x000000010b214296 -[UIPopoverPresentationController _sourceView] + 55
[ERROR] : 6 UIKit 0x000000010b2125d9 -[UIPopoverPresentationController _initialPresentationViewControllerForViewController:] + 95
[ERROR] : 7 UIKit 0x000000010aa42909 -[UIViewController _modalPresenterForPresentationController:] + 55
[ERROR] : 8 UIKit 0x000000010aa50191 -[UIViewController _presentViewController:withAnimationController:completion:] + 2855
[ERROR] : 9 UIKit 0x000000010b265c46 -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 300
[ERROR] : 10 UIKit 0x000000010b2624a6 -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 149
[ERROR] : 11 UIKit 0x000000010b2621f9 -[_UIViewControllerTransitionContext completeTransition:] + 117
[ERROR] : 12 UIKit 0x000000010a958daa -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 644
[ERROR] : 13 UIKit 0x000000010a9373a7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241
[ERROR] : 14 UIKit 0x000000010a937756 -[UIViewAnimationState animationDidStop:finished:] + 80
[ERROR] : 15 QuartzCore 0x000000010cab4d70 _ZN2CA5Layer23run_animation_callbacksEPv + 308
[ERROR] : 16 libdispatch.dylib 0x000000010fe0d4a7 _dispatch_client_callout + 8
[ERROR] : 17 libdispatch.dylib 0x000000010fdf7fc9 _dispatch_main_queue_callback_4CF + 714
[ERROR] : 18 CoreFoundation 0x000000010df963e9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
[ERROR] : 19 CoreFoundation 0x000000010df57939 __CFRunLoopRun + 2073
[ERROR] : 20 CoreFoundation 0x000000010df56e98 CFRunLoopRunSpecific + 488
[ERROR] : 21 GraphicsServices 0x000000010fa5dad2 GSEventRunModal + 161
[ERROR] : 22 UIKit 0x000000010a8b2676 UIApplicationMain + 171
[ERROR] : 23 ShakeLocate 0x00000001083a5e16 main + 310
[ERROR] : 24 libdyld.dylib 0x000000010fe3c92d start + 1
[ERROR] : 25 ??? 0x0000000000000001 0x0 + 1
[ERROR] : )
[ERROR] : libc++abi.dylib: terminating with uncaught exception of type NSException