React Native ios: App crashes when it sent to the background - ios

I have a React Native ios app. I'm trying to solve a problem but I couldn't manage to solve it yet.
When I send the app to the background with pressing the home button twice or whenever I pass to another app, app crashes. You can see the video below;
You can see error image with this link
http://sendvid.com/gwoqfybp
Error:
2016-11-08 20:51:58.874 NewsApp[33572:686315] -[RCTDeviceExtension orientationDidChange:]: unrecognized selector sent to instance 0x60000001d100
2016-11-08 20:51:58.884 NewsApp[33572:686315] WARNING: GoogleAnalytics 3.15 void GAIUncaughtExceptionHandler(NSException *) (GAIUncaughtExceptionHandler.m:48): Uncaught exception: -[RCTDeviceExtension orientationDidChange:]: unrecognized selector sent to instance 0x60000001d100
2016-11-08 20:51:59.018 NewsApp[33572:686315] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
2016-11-08 20:51:59.961503 NewsApp[33572:689959] [] __nw_connection_get_connected_socket_block_invoke 210 Connection has no connected handler
2016-11-08 20:52:03.298381 NewsApp[33572:689437] [] __nw_connection_get_connected_socket_block_invoke 211 Connection has no connected handler
2016-11-08 20:52:04.005 NewsApp[33572:686315] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTDeviceExtension orientationDidChange:]: unrecognized selector sent to instance 0x60000001d100'
*** First throw call stack:
(
0 CoreFoundation 0x000000010789f34b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000106ccb21e objc_exception_throw + 48
2 CoreFoundation 0x000000010790ef34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000107824c15 ___forwarding___ + 1013
4 CoreFoundation 0x0000000107824798 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x000000010783d19c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x000000010783d09b _CFXRegistrationPost + 427
7 CoreFoundation 0x000000010783ce02 ___CFXNotificationPost_block_invoke + 50
8 CoreFoundation 0x00000001077ffea2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 2018
9 CoreFoundation 0x00000001077fef3b _CFXNotificationPost + 667
10 Foundation 0x00000001067930ab -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
11 UIKit 0x0000000108d24e3e -[UIApplication _stopDeactivatingForReason:] + 633
12 UIKit 0x0000000108d2c712 __62-[UIApplication _sceneSettingsPostLifecycleEventDiffInspector]_block_invoke.1251 + 107
13 FrontBoardServices 0x000000010bc1a7f5 __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke.27 + 231
14 Foundation 0x00000001067f7199 __NSIndexSetEnumerate + 1027
15 BaseBoard 0x000000010be05acb -[BSSettingsDiff inspectChangesWithBlock:] + 116
16 FrontBoardServices 0x000000010bc14354 -[FBSSettingsDiff inspectOtherChangesWithBlock:] + 92
17 FrontBoardServices 0x000000010bc1a598 -[FBSSettingsDiffInspector inspectDiff:withContext:] + 332
18 UIKit 0x0000000108d2d1a8 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 201
19 UIKit 0x0000000108d2cdea -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 1060
20 UIKit 0x0000000109258676 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 492
21 FrontBoardServices 0x000000010bc0302e __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.376 + 204
22 FrontBoardServices 0x000000010bc31723 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
23 FrontBoardServices 0x000000010bc3159c -[FBSSerialQueue _performNext] + 189
24 FrontBoardServices 0x000000010bc31925 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
25 CoreFoundation 0x0000000107844311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26 CoreFoundation 0x000000010782959c __CFRunLoopDoSources0 + 556
27 CoreFoundation 0x0000000107828a86 __CFRunLoopRun + 918
28 CoreFoundation 0x0000000107828494 CFRunLoopRunSpecific + 420
29 GraphicsServices 0x000000010b819a6f GSEventRunModal + 161
30 UIKit 0x0000000108d2f964 UIApplicationMain + 159
31 NewsApp 0x0000000102822dcf main + 111
32 libdyld.dylib 0x000000010a70668d start + 1
33 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Solution
Basically problem caused by a Google Analytics plugin. I switched to Fribase Analytics and problem solved!

You need to change the app state and make sure no processes are running like push notifications that won't run in the background. Try to post the code that's running and I will try to change my answer.
getInitialState: function() {
return {
currentAppState: AppState.currentState,
};
},
componentDidMount: function() {
AppState.addEventListener('change', this._handleAppStateChange);
},
componentWillUnmount: function() {
AppState.removeEventListener('change', this._handleAppStateChange);
},
_handleAppStateChange: function(currentAppState) {
this.setState({ currentAppState, });
},
render: function() {
return (
<Text>Current state is: {this.state.currentAppState}</Text>
);
},
read more here for full example and documentation
https://facebook.github.io/react-native/docs/appstate.html

Related

IOS Swift, Google SignIn run time error at GIDSignIn.sharedInstance().clientID

I am trying to implement Google SignIn in my iOS project and getting runtime error at line:
GIDSignIn.sharedInstance().clientID = "mysecrectkey.apps.googleusercontent.com"
in AppDelegate. Error I am getting is something like below. I followed each step which is mentioned in following link and still no luck.
http://www.theappguruz.com/blog/integrate-google-signin-sdk-in-ios-application-using-swift
I tried adding -ObjC in Other Linker Flags section as well. Please help me to figure this out. Thanks
2016-10-09 17:16:57.754 GoogleLoginTest1[8996:611837] -[__NSDictionaryI gtm_httpArgumentsString]: unrecognized selector sent to instance 0x618000071a80
2016-10-09 17:16:57.758 GoogleLoginTest1[8996:611837] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI gtm_httpArgumentsString]: unrecognized selector sent to instance 0x618000071a80'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ce2234b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010c46621e objc_exception_throw + 48
2 CoreFoundation 0x000000010ce91f34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010cda7c15 ___forwarding___ + 1013
4 CoreFoundation 0x000000010cda7798 _CF_forwarding_prep_0 + 120
5 GoogleLoginTest1 0x000000010bb4272e -[GSDK_GTMSessionFetcherSessionDelegateDispatcher .cxx_destruct] + 11318
6 GoogleLoginTest1 0x000000010bb44551 -[GSDK_GTMSessionFetcherSessionDelegateDispatcher .cxx_destruct] + 19033
7 GoogleLoginTest1 0x000000010bb43fc4 -[GSDK_GTMSessionFetcherSessionDelegateDispatcher .cxx_destruct] + 17612
8 GoogleLoginTest1 0x000000010bb223ed _TFC16GoogleLoginTest111AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 685
9 GoogleLoginTest1 0x000000010bb22594 _TToFC16GoogleLoginTest111AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180
10 UIKit 0x000000010da4068e -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
11 UIKit 0x000000010da42013 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
12 UIKit 0x000000010da483b9 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
13 UIKit 0x000000010da45539 -[UIApplication workspaceDidEndTransaction:] + 188
14 FrontBoardServices 0x00000001131ac76b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
15 FrontBoardServices 0x00000001131ac5e4 -[FBSSerialQueue _performNext] + 189
16 FrontBoardServices 0x00000001131ac96d -[FBSSerialQueue _performNextFromRunLoopSource] + 45
17 CoreFoundation 0x000000010cdc7311 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18 CoreFoundation 0x000000010cdac59c __CFRunLoopDoSources0 + 556
19 CoreFoundation 0x000000010cdaba86 __CFRunLoopRun + 918
20 CoreFoundation 0x000000010cdab494 CFRunLoopRunSpecific + 420
21 UIKit 0x000000010da43db6 -[UIApplication _run] + 434
22 UIKit 0x000000010da49f34 UIApplicationMain + 159
23 GoogleLoginTest1 0x000000010bb24cdf main + 111
24 libdyld.dylib 0x000000010fc4d68d start + 1
25 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
have you added Other linker flag : -OjcC

iOS - Crash with google admob SDK after upgraded to v7.7.0

We upgraded google admob v7.5.1 to v7.7.0 through pod file. After upgrade app crash on launching with following log.
2016-03-21 12:17:47.065 myAppName[3672:83997] -[NSTaggedPointerString count]: unrecognized selector sent to instance 0xa0110632e20924c9
2016-03-21 12:17:47.119 myAppName[3672:83997] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString count]: unrecognized selector sent to instance 0xa0110632e20924c9'
*** First throw call stack:
(
0 CoreFoundation 0x000000010a3e8e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109e5fdeb objc_exception_throw + 48
2 CoreFoundation 0x000000010a3f148d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010a33e90a ___forwarding___ + 970
4 CoreFoundation 0x000000010a33e4b8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x000000010a300e84 -[NSSet initWithArray:] + 36
6 myAppName 0x000000010579e66e hasRequiredParams + 19102
7 myAppName 0x000000010579c3a3 hasRequiredParams + 10195
8 myAppName 0x000000010579c1fc hasRequiredParams + 9772
9 myAppName 0x000000010579c048 hasRequiredParams + 9336
10 myAppName 0x000000010573ad87 GADiTunesMetadataForFileAtPath + 2024
11 myAppName 0x000000010573a7d2 GADiTunesMetadataForFileAtPath + 563
12 Foundation 0x0000000106d07790 -[__NSObserver _doit:] + 304
13 CoreFoundation 0x000000010a3b569c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
14 CoreFoundation 0x000000010a3b53db _CFXRegistrationPost + 427
15 CoreFoundation 0x000000010a3b5142 ___CFXNotificationPost_block_invoke + 50
16 CoreFoundation 0x000000010a3fa972 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1986
17 CoreFoundation 0x000000010a2b0279 _CFXNotificationPost + 633
18 Foundation 0x0000000106ceb109 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
19 UIKit 0x0000000107cb06f0 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4272
20 UIKit 0x0000000107cb6cc6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1760
21 UIKit 0x0000000107cb3e7b -[UIApplication workspaceDidEndTransaction:] + 188
22 FrontBoardServices 0x000000010bcdf754 -[FBSSerialQueue _performNext] + 192
23 FrontBoardServices 0x000000010bcdfac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
24 CoreFoundation 0x000000010a314a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25 CoreFoundation 0x000000010a30a95c __CFRunLoopDoSources0 + 556
26 CoreFoundation 0x000000010a309e13 __CFRunLoopRun + 867
27 CoreFoundation 0x000000010a309828 CFRunLoopRunSpecific + 488
28 UIKit 0x0000000107cb37cd -[UIApplication _run] + 402
29 UIKit 0x0000000107cb8610 UIApplicationMain + 171
30 myAppName 0x00000001055b4c7e main + 62
31 libdyld.dylib 0x000000010a8d492d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Google Maps iOS SDK "mapView:didTapMarker:" crashes

I have a subclass of GMSMarker called customMarker.
My user gets notifications every time he approaches one of the markers on the map.
I want that when the user clicks on a notification, the marker will be already selected (when the app opens from the notification) adn its infoWindow will be visible.
I try to do it like this:
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
AroundersViewController *aroundersVC=[[UIStoryboard storyboardWithName:#"Main" bundle:nil] instantiateViewControllerWithIdentifier:#"aroundersPage"];
NSString *markerIdentifier=[[notification userInfo] objectForKey:#"markerIdentifier"];
CustomMarker *notificationsMarker=[self.monitorLocationVC markerForIdentifier:markerIdentifier];
[aroundersVC mapView:aroundersVC.mapView didTapMarker: notificationsMarker]; //App crashes here
}
But the app crashes with this error log message:
2016-02-11 20:39:30.355 App[15887:4216691] -[AroundersViewController mapView:didTapMarker:]: unrecognized selector sent to instance 0x7fa01bcf5890
2016-02-11 20:39:30.365 App[15887:4216691] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AroundersViewController mapView:didTapMarker:]: unrecognized selector sent to instance 0x7fa01bcf5890'
*** First throw call stack:
(
0 CoreFoundation 0x0000000105257e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104cd0deb objc_exception_throw + 48
2 CoreFoundation 0x000000010526048d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00000001051ad727 ___forwarding___ + 487
4 CoreFoundation 0x00000001051ad4b8 _CF_forwarding_prep_0 + 120
5 App 0x0000000101988dab -[AppDelegate application:didReceiveLocalNotification:] + 523
6 UIKit 0x000000010561cdc5 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 3650
7 UIKit 0x0000000105622cc1 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 214
8 UIKit 0x0000000105622b95 -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 508
9 UIKit 0x0000000105602007 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 159
10 UIKit 0x0000000105601c94 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 843
11 FrontBoardServices 0x0000000108027754 -[FBSSerialQueue _performNext] + 192
12 FrontBoardServices 0x0000000108027ac2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x0000000105183a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010517995c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x0000000105178e13 __CFRunLoopRun + 867
16 CoreFoundation 0x0000000105178828 CFRunLoopRunSpecific + 488
17 GraphicsServices 0x0000000107e53ad2 GSEventRunModal + 161
18 UIKit 0x0000000105604610 UIApplicationMain + 171
19 App 0x000000010199fd7f main + 111
20 libdyld.dylib 0x0000000106c7f92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Does anybody have an idea?
Thanks!

Parse error in existing project

I see this error when I try to initialize parse with app key and client key.
2015-10-08 13:29:56.484 My wish List[7892:4257341] -[ParseManager initWithApplicationId:clientKey:]: unrecognized selector sent to instance 0x7fe86ac35ef0
2015-10-08 13:29:56.491 My wish List[7892:4257341] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ParseManager initWithApplicationId:clientKey:]: unrecognized selector sent to instance 0x7fe86ac35ef0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001045bef65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104038deb objc_exception_throw + 48
2 CoreFoundation 0x00000001045c758d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000104514f7a ___forwarding___ + 970
4 CoreFoundation 0x0000000104514b28 _CF_forwarding_prep_0 + 120
5 My wish List 0x00000001026c7d5f +[Parse setApplicationId:clientKey:] + 212
6 My wish List 0x000000010266d07d -[AppDelegate application:didFinishLaunchingWithOptions:] + 109
7 UIKit 0x00000001049624ca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
8 UIKit 0x0000000104963670 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
9 UIKit 0x0000000104969e15 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1755
10 UIKit 0x0000000104966ff0 -[UIApplication workspaceDidEndTransaction:] + 188
11 FrontBoardServices 0x000000010c7847ac -[FBSSerialQueue _performNext] + 192
12 FrontBoardServices 0x000000010c784b1a -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x00000001044eb0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x00000001044e0fcc __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x00000001044e0483 __CFRunLoopRun + 867
16 CoreFoundation 0x00000001044dfe98 CFRunLoopRunSpecific + 488
17 UIKit 0x000000010496698d -[UIApplication _run] + 402
18 UIKit 0x000000010496b676 UIApplicationMain + 171
19 My wish List 0x000000010266d30f main + 111
20 libdyld.dylib 0x0000000105f0292d start + 1
21 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

How to understand and fixed this error?

2011-04-20 18:38:41.347 RIE[1683:607] -[UICGColor _shouldContinuePlaybackInBackground]: unrecognized selector sent to instance 0x28db10
2011-04-20 18:38:41.417 RIE[1683:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICGColor _shouldContinuePlaybackInBackground]: unrecognized selector sent to instance 0x28db10'
*** Call stack at first throw:
(
0 CoreFoundation 0x342ed64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x35570c5d objc_exception_throw + 24
2 CoreFoundation 0x342f11bf -[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x342f0649 ___forwarding___ + 508
4 CoreFoundation 0x34267180 _CF_forwarding_prep_0 + 48
5 MediaPlayer 0x344628b7 -[MPMoviePlayerViewController _moviePlayerViewController_applicationDidEnterBackgroundNotification:] + 42
6 Foundation 0x333b5183 _nsnote_callback + 142
7 CoreFoundation 0x342bc20f __CFXNotificationPost_old + 402
8 CoreFoundation 0x34256eeb _CFXNotificationPostNotification + 118
9 Foundation 0x333b25d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 70
10 UIKit 0x36364d01 -[UIApplication _handleApplicationSuspend:eventInfo:] + 500
11 UIKit 0x362feaf9 -[UIApplication handleEvent:withNewEvent:] + 1916
12 UIKit 0x362fe215 -[UIApplication sendEvent:] + 44
13 UIKit 0x362fdc53 _UIApplicationHandleEvent + 5090
14 GraphicsServices 0x33e58e77 PurpleEventCallback + 666
15 CoreFoundation 0x342c4a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
16 CoreFoundation 0x342c683f __CFRunLoopDoSource1 + 166
17 CoreFoundation 0x342c760d __CFRunLoopRun + 520
18 CoreFoundation 0x34257ec3 CFRunLoopRunSpecific + 230
19 CoreFoundation 0x34257dcb CFRunLoopRunInMode + 58
20 GraphicsServices 0x33e5841f GSEventRunModal + 114
21 GraphicsServices 0x33e584cb GSEventRun + 62
22 UIKit 0x36328d69 -[UIApplication _run] + 404
23 UIKit 0x36326807 UIApplicationMain + 670
24 Motor Show 0x0000219b main + 70
25 Motor Show 0x00002150 start + 40
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
Hard to say given just the stack trace, but I would suggest the following:
Implement applicationWillResignActive: in your UIApplicationDelegate to ensure that video playback is paused or stopped before the application enters the background.
Create a custom UIApplication subclass to use in your app, and override the _handleApplicationSuspend:eventInfo: method so that it returns without propagating the event to other classes further down the chain.
Figure out how to unregister your MPMoviePlayerViewController component from the notification center so that it does not receive the 'ApplicationDidEnterBackgroundNotification'.

Resources