Key "player" has changed without an appropriate KVO notification being sent - ios

I am observing AVPlayer object KVO notification in my class PCSPlayerNotification and I found the below crash.I am unable to reproduce this issue and I get this issue rarely.
I read this http://www.cocoabuilder.com/archive/cocoa/204196-cannot-remove-observer-error.html and I found the cause of the issue must be with KVO notification that is sent by AVPlayer.But not sure how to fix ,can anyone help me to fix this issue.
Issue :
Fatal Exception: NSInternalInconsistencyException
Cannot update for observer <PCSPlayerNotification 0x7f78b70> for the key path "player.currentItem.playbackLikelyToKeepUp" from <PCSPlayerNotification 0x7f78b70>, most likely because the value for the key "player" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the PCSPlayerNotification class.
Crash :
Thread : Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x2b2315a7 __exceptionPreprocess
1 libobjc.A.dylib 0x39156c77 objc_exception_throw
2 CoreFoundation 0x2b2314ed -[NSException initWithCoder:]
3 Foundation 0x2bed464d -[NSKeyValueNestedProperty object:withObservance:didChangeValueForKeyOrKeys:recurse:forwardingValues:]
4 Foundation 0x2beb4151 NSKeyValueDidChange
5 Foundation 0x2bea0991 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:]
6 VZFiOSMobile 0x4f33f1 (Missing)
7 libdispatch.dylib 0x396c1c83 _dispatch_call_block_and_release
8 libdispatch.dylib 0x396c1c6f _dispatch_client_callout
9 libdispatch.dylib 0x396cd553 _dispatch_main_queue_callback_4CF$VARIANT$mp
10 CoreFoundation 0x2b1f7891 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
11 CoreFoundation 0x2b1f5fb1 __CFRunLoopRun
12 CoreFoundation 0x2b142b51 CFRunLoopRunSpecific
13 CoreFoundation 0x2b142963 CFRunLoopRunInMode
14 GraphicsServices 0x326501a9 GSEventRunModal
15 UIKit 0x2e794c91 UIApplicationMain
16 VZFiOSMobile 0x272c1d main (main.m:16)
17 libdyld.dylib 0x396ffaaf start

Related

Crash on NotificationCenter addObserver call

I'm new to this project and Firebase has been added only recently, so I've some issue to figure out the reason of a crash (that I can't reproduce locally).
It's a EXC_BAD_ACCESS KERN_INVALID_ADDRESS on dispatch_call_block_and_release.
Therefore it should be a memory issue, trying to access to an object that has been already deallocated.
The last traced line is an addObserver call of Notification Center, and then the call trace continue with several calls but not showing an exact line of code. Since I don't see anything wrong with that observer, I'm wondering: is this line significant? Or it could be that the app is crashing on a different thread so that the call trace is irrelevant?
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000008
Crashed: com.apple.main-thread
0 MyPod 0x103dafb18 (Missing)
1 MyPod 0x103daf564 (Missing)
2 MyPod 0x103daf9fc (Missing)
3 MyApp 0x103b12ffc (Missing)
4 MyPod 0x103daf268 (Missing)
5 MyPod 0x103dae844 (Missing)
6 MyPod 0x103daef64 (Missing)
7 MyPodClient 0x103d40fd0 (Missing)
8 MyPodClient 0x103d3dcb8 (Missing)
9 libdispatch.dylib 0x1a9e38610 _dispatch_call_block_and_release + 24
10 libdispatch.dylib 0x1a9e39184 _dispatch_client_callout + 16
11 libdispatch.dylib 0x1a9deb190 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1044
12 CoreFoundation 0x1aa0ea5e4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13 CoreFoundation 0x1aa0e55d8 __CFRunLoopRun + 2004
14 CoreFoundation 0x1aa0e4adc CFRunLoopRunSpecific + 464
15 GraphicsServices 0x1b406a328 GSEventRunModal + 104
16 UIKitCore 0x1ae1dfae0 UIApplicationMain + 1936
17 MyApp 0x102e0bce0 main + 21 (PlayerPlugin.swift:21) //-> This is the line in which a func is called, and inside this func observers are added.
thanks
ps. I don't know if this helps, but for some crash reports (but not all of them), I get in the KEYS section this line:
crash_info_entry_0
CoreUI: deallocating _CUIInternalLinkRendition 7113 /private/var/containers/Bundle/Application/A6721767-C6DD-43AB-B2E0-094D4CBD12D6/MyApp.app/Assets.car
Is this related to assets? However it looks more like a consequence of the crash, rather than a cause.

App crashes using Facebook Login SDK when I go to the home screen

I originally downloaded the FBSDK's version 4.10 and integrated them into my application by placing them in the frameworks folder. Realizing that these would not get updated over time, I removed them completely and tried to add them as pods to my project. The pods installed successfully, I have imported them correctly in my bridging header file, and there were no other issues. The pods update installed version 4.11 which has caused me some headache.
I am using the FBSDKLoginKit to log a user into their account and retrieve information from that. I am able to get back a dictionary with the users information just fine. I then pass this information to the next ViewController with a segue. At any point after this, if I press the home button on my iPhone or simulator, the app will crash. The error I get is
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]:
attempt to insert nil object from objects[3]'
This exception also occurs if I let the user log in through facebook, segue to the new view controller, unwind to the previous view controller, and then attempt to log in again. I have attempted to log the user out once retrieving their pertinent information on the second screen, but the error still persists.
I have seen a similar question asked where the "solution" was that the FBSDKLoginKit writes the retrieved dictionary to a variable and if the dictionary it has retrieved back has nil values, it throws this error.
Is there anything I can do to catch this before it happens? Has anyone found a work around?
Here is my output from the simulator when I press home:
*** First throw call stack:
(
0 CoreFoundation 0x0000000106f03d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010643edeb objc_exception_throw + 48
2 CoreFoundation 0x0000000106e0023e -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318
3 CoreFoundation 0x0000000106e125bb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
4 APPNAME 0x0000000101607a1e -[FBSDKTimeSpentData instanceSuspend] + 622
5 APPNAME 0x000000010160766b +[FBSDKTimeSpentData suspend] + 59
6 APPNAME 0x00000001015b5986 -[FBSDKAppEvents applicationMovingFromActiveStateOrTerminating] + 262
7 CoreFoundation 0x0000000106ecdc8c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
8 CoreFoundation 0x0000000106ecd9cb _CFXRegistrationPost + 427
9 CoreFoundation 0x0000000106ecd732 ___CFXNotificationPost_block_invoke + 50
10 CoreFoundation 0x0000000106f161e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1986
11 CoreFoundation 0x0000000106dc5679 _CFXNotificationPost + 633
12 Foundation 0x000000010372ccd9 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
13 UIKit 0x0000000104a685ad -[UIApplication _deactivateForReason:notify:] + 629
14 UIKit 0x0000000104a6f1f1 __61-[UIApplication _sceneSettingsPreLifecycleEventDiffInspector]_block_invoke + 104
15 FrontBoardServices 0x0000000108f88d6c __52-[FBSSettingsDiffInspector inspectDiff:withContext:]_block_invoke27 + 213
16 Foundation 0x000000010377d5bb __NSIndexSetEnumerate + 1016
17 BaseBoard 0x000000010901ba8c -[BSSettingsDiff inspectChangesWithBlock:] + 116
18 FrontBoardServices 0x0000000108f83e4a -[FBSSettingsDiff inspectOtherChangesWithBlock:] + 92
19 FrontBoardServices 0x0000000108f88b2f -[FBSSettingsDiffInspector inspectDiff:withContext:] + 317
20 UIKit 0x0000000104a70880 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 127
21 UIKit 0x0000000104a7052d -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 843
22 FrontBoardServices 0x0000000108f978c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
23 FrontBoardServices 0x0000000108f97741 -[FBSSerialQueue _performNext] + 178
24 FrontBoardServices 0x0000000108f97aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
25 CoreFoundation 0x0000000106e29301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
26 CoreFoundation 0x0000000106e1f22c __CFRunLoopDoSources0 + 556
27 CoreFoundation 0x0000000106e1e6e3 __CFRunLoopRun + 867
28 CoreFoundation 0x0000000106e1e0f8 CFRunLoopRunSpecific + 488
29 GraphicsServices 0x0000000108ae7ad2 GSEventRunModal + 161
30 UIKit 0x0000000104a72f09 UIApplicationMain + 171
31 APPNAME 0x00000001013a26d2 main + 114
32 libdyld.dylib 0x0000000107b0d92d start + 1
33 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Running my code step by step I find that the error occurs during the method:
fbLoginManager.logInWithReadPermissions(permissionsNeeded, fromViewController: self) { (result, error) -> Void in
//crashes before it enters this block
//my code here
}
It crashes before I can even check the error value. I will attempt to check the values by stepping into the fbsdk methods and update
As soon as I press OK on this screen for the second time it crashes. How can I debug this? The action isn't in my app, its in the browser so I'm not sure where to go from here..
I have came across this issues recently, and i solved it by adding this piece of code in Appdelegate.m.
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
For Swift 3 version:
func applicationDidBecomeActive(_ application: UIApplication) {
FBSDKAppEvents.activateApp()
}
Update to 4.12, it fixes the issue according to their release notes:
https://developers.facebook.com/docs/ios/change-log-4.x/
The part that says:
Fixed
Fixed cases where AppEvents could crash because of missing session id.
Fixed bug in some cases where access token expiration date was the refresh date.
Although this is not necessarily a comprehensive solution, I have exhausted my debugging methods. I have removed the FBSDK's from my podfile, run pod update to remove them from the project, and reinstalled the version 4.10 FBSDK's in my frameworks folder. I will update this question after trying again when facebook releases an updated version of the FBSDK's.

Bridging an ObjC project with the SalesForce SDK causes a crash due to inability to find a category in the SF SDK

I have an iOS project called Core.proj that includes the SalesForce SDK and it is written in Objective-C. This project utilises the SF SDK and links the binary to the SF libraries. It does a bunch of stuff to help manage my implementation of SF. It is included in all my other Obj-C projects and it works absolutely fine within them.
This is the first time I am using this project with Swift (2.1). I am using iOS 9 with Xcode 7.1.1. I added the Core.xcodeproj into my Swift project. I then created an ObjC file. Xcode then asks if I want to create a bridging header. I do. I have created a bridging header called Swift-Bridging-Header.h. This enables me to access the files in Core.xcodeproj via the bridging header. For example, I can access my own version of the Salesforce Authentication Manager from the bridging header.
In my app delegate, I want to now kick off OAuth (I'm keeping this minimal here):
let sharedManager = MyAuthenticationManager.sharedManager()
let successBlock: OAuthFlowSuccessCallbackBlock = { sfAuthInfo in }
let failureBlock: OAuthFlowFailureCallbackBlock = { sfAuthInfo in }
sharedManager.loginWithCompletion(successBlock, failure: failureBlock)
Full disclosure: each block that you see here takes the SFOAuthInfo object as an argument. In order to get Swift to read this block, I had to add SFOAuthInfo.h into the copy files.
Now this all compiles fine but when I tap to login and execute the above code, I get the following error:
2015-12-04 11:53:54.879 MyApp[19108:3494140] -[UIDevice macaddress]: unrecognized selector sent to instance 0x7fcfb4903230
2015-12-04 11:53:54.890 MyApp[19108:3494140] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDevice macaddress]: unrecognized selector sent to instance 0x7fcfb4903230'
*** First throw call stack:
(
0 CoreFoundation 0x000000010d6adf65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010f624deb objc_exception_throw + 48
2 CoreFoundation 0x000000010d6b658d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010d603f7a ___forwarding___ + 970
4 CoreFoundation 0x000000010d603b28 _CF_forwarding_prep_0 + 120
5 MyApp 0x000000010c869317 -[SFOAuthCredentials keyMacForService:] + 84
6 MyApp 0x000000010c8696b8 -[SFOAuthCredentials updateTokenEncryption] + 210
7 MyApp 0x000000010c8673ee -[SFOAuthCredentials initWithIdentifier:clientId:encrypted:] + 211
8 MyApp 0x000000010c84102c -[SFUserAccount initWithIdentifier:] + 197
9 MyApp 0x000000010c85f32d -[SFUserAccountManager createUserAccount] + 91
10 MyApp 0x000000010c831b41 -[SFAuthenticationManager loginWithCompletion:failure:account:] + 284
11 MyApp 0x000000010c831a0b -[SFAuthenticationManager loginWithCompletion:failure:] + 53
12 MyApp 0x000000010c60440c -[MyAuthenticationManager loginWithCompletion:failure:] + 124
13 MyApp 0x000000010c5dc58f _TFC18MyApp11AppDelegate5loginfS0_FT_T_ + 911
14 MyApp 0x000000010c5dfdc4 _TFC18MyApp25LandingPageViewController17loginButtonTappedfS0_FPSs9AnyObject_T_ + 68
15 MyApp 0x000000010c5dfe16 _TToFC18MyApp25LandingPageViewController17loginButtonTappedfS0_FPSs9AnyObject_T_ + 54
16 UIKit 0x000000010e1af1fa -[UIApplication sendAction:to:from:forEvent:] + 92
17 UIKit 0x000000010e313504 -[UIControl sendAction:to:forEvent:] + 67
18 UIKit 0x000000010e3137d0 -[UIControl _sendActionsForEvents:withEvent:] + 311
19 UIKit 0x000000010e312906 -[UIControl touchesEnded:withEvent:] + 601
20 UIKit 0x000000010e219aa3 -[UIWindow _sendTouchesForEvent:] + 835
21 UIKit 0x000000010e21a691 -[UIWindow sendEvent:] + 865
22 UIKit 0x000000010e1cc752 -[UIApplication sendEvent:] + 263
23 UIKit 0x000000010e1a7fcc _UIApplicationHandleEventQueue + 6693
24 CoreFoundation 0x000000010d5da0a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25 CoreFoundation 0x000000010d5cffcc __CFRunLoopDoSources0 + 556
26 CoreFoundation 0x000000010d5cf483 __CFRunLoopRun + 867
27 CoreFoundation 0x000000010d5cee98 CFRunLoopRunSpecific + 488
28 GraphicsServices 0x0000000113e46ad2 GSEventRunModal + 161
29 UIKit 0x000000010e1ad676 UIApplicationMain + 171
30 MyApp 0x000000010c5ddd8d main + 109
31 libdyld.dylib 0x00000001107a592d start + 1
32 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The SF SDK has a category called UIDevice+SFHardware.h. Within this category there is a method called 'macaddress'. So clearly it is not correctly reading this category. But why? As you can see from the stack trace it is reading the other files in the SF SDK correctly.
I tried a number of things to get this to work. For example, this: iOS - UUID generation throwing a strange exception but with UIDevice+SFHardware.h. I tried this: https://developer.salesforce.com/forums/?id=906F00000009CBvIAM. I completely rebuilt the project again to check my working.
I shouldn't need to add this file into my bridge as this UIDevice+SFHardware.h is only ever accessed from SF SDK which sits within an ObjC project.
I must have done something wrong though. Any help would be greatly appreciated.
I just went through this issue.
In your Project > Build Settings > Other Linker Flags add:
-ObjC
-all_load
My SalesforceSDK is in my Pod project. If you're doing the same, set those flags in your SalesforceMobileSDK-iOS project. If not, wherever the Salesforce SDK is getting compiled.
It turns out this was a combination of things. Firstly, I was missing the -ObjC linker flag in BOTH the Swift project and the Objc project. Thanks DarthVadar123451 for pointing that out. But I also realised I was missing two libraries: libz.dylib and libxml2.dylib. Once added, everything worked. I hope that helps anyone running into the same issue.

Mysterious crash in iOS 9: -[SKTAppDelegate application:didReceiveLocalNotification:]: unrecognized selector sent to instance

I got a crash report after exercising my app from Crashlytics. I tooks like this:
The full stacktrace as given looks like this:
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 578074103 __exceptionPreprocess
1 libobjc.A.dylib 807402615 objc_exception_throw
2 CoreFoundation 578095805 __methodDescriptionForSelector
3 CoreFoundation 578086961 ___forwarding___
4 CoreFoundation 577239944 _CF_forwarding_prep_0
5 MakeEatSee 2151151 didReceiveLocalNotificationNewImpl
6 UIKit 635813433 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:]
7 UIKit 635780589 -[UIApplication workspace:didReceiveActions:]
8 FrontBoardServices 686207177 __31-[FBSSerialQueue performAsync:]_block_invoke
9 CoreFoundation 577839101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
10 CoreFoundation 577835713 __CFRunLoopDoBlocks
11 CoreFoundation 577830427 __CFRunLoopRun
12 CoreFoundation 577096497 CFRunLoopRunSpecific
13 CoreFoundation 577096003 CFRunLoopRunInMode
14 GraphicsServices 698237009 GSEventRunModal
15 UIKit 633677553 UIApplicationMain
16 MakeEatSee 502059 main (main.m:14)
17 libdyld.dylib 813284015 start
MakeEatSee is the name of my app. This happened around the time a NSNotification got posted.
I've tested this codepath before, and it's definitely worked before.
I can't make sense of this crash. Reasons being:
There's no mentions of SKTAppDelegate anywhere in the stack trace.
There's no SKTAppDelegate in the codebase, as far as I know. SKT prefix is usually for SupportKit, the old name for Smooch. This, I do use in the app. But there's no , which I do use in the app.
The only mention of SKTAppDelegate leads you to some Apple demo sources
There is no didReceiveLocalNotificationNewImpl method in my app.
Why did this crash happen? What can I do to fix it?
I found out that this is caused by using Smooch iOS SDK 3.0.0. I have updated to the latest version 3.0.1 and this problem appears to have been resolved.

libobjc.A.dylib at objc_msgSend:15 crash

Anyone have any insight as to what is causing the following crash?
CLASS:
SIGNAL
FILE:
libobjc.A.dylib at objc_msgSend:15
IOS:
5.1
0libobjc.A.dylib 0x30f7ef78 objc_msgSend 15
1libobjc.A.dylib 0x30f80175 _objc_rootRelease 36
2UIKit 0x3713542d -[UILayoutContainerView _endFastMode] 132
3UIKit 0x37135279 -[UILayoutContainerView setUseFastMode:] 68
4UIKit 0x37090129 -[UIView(FastModeAdditions) _setContainerLayoutViewForFastMode:] 104
5UIKit 0x36ef637b -[UIView dealloc] 574
6UIKit 0x371e0491 -[UIDropShadowView dealloc] 92
7libobjc.A.dylib 0x30f80175 _objc_rootRelease 36
8CoreFoundation 0x36b9c2e7 CFRelease 94
9CoreFoundation 0x36c18b37 __CFDictionaryStandardReleaseValue 70
10CoreFoundation 0x36c6c3bc __CFBasicHashDrain 264
11CoreFoundation 0x36b9c39b CFRelease 274
12libobjc.A.dylib 0x30f81e57 objc_release 38
13libobjc.A.dylib 0x30f80ead _ZN12_GLOBAL__N_119AutoreleasePoolPage3popEPv 224
14libobjc.A.dylib 0x30f80dc9 _objc_autoreleasePoolPop 12
15CoreFoundation 0x36ba3cff _CFAutoreleasePoolPop 18
16CoreFoundation 0x36c262b3 __CFRunLoopRun 1274
17CoreFoundation 0x36ba94a5 CFRunLoopRunSpecific 300
18CoreFoundation 0x36ba936d CFRunLoopRunInMode 104
19GraphicsServices 0x30c8b439 GSEventRunModal 136
20UIKit 0x36efae7d UIApplicationMain 1080
I would suspect you are releasing an object that is already released (implicitly within the autorelease pool). You need to enable zombies and add breakpoints on objc_exception_throw, etc.
Source: trojanfoe comment
This crash sounds like it happened in UIKit framework while sending the message using objc_msgSend function (part of Objective-C).
You should compile your source code with the debug symbols and generate another more detailed backtrace. Use also debuggers such as dtrace/dtruss to further check problems with your code.
This could be a iOS bug with scrolling as mentioned in here: App crashes when Back button tapped while scrolling table view.
See also: objc_msgSend at ridiculousfish

Resources