Unity iOS game crashing with NSInternalInconsistencyException - ios

I am using Prime31's GameCenter Turn Based plugin in my game in order to handle online matches. A problem arises when I receive an "invitation to play" notification from Game Center while Game Center's matchmaker is showing (called using the plug-in => GameCenterTurnBasedBinding.findMatch(2,2,false); ).
The app crashes and the following output is shown in Xcode:
2012-08-20 08:39:27.050 Cabrais[1808:707] *** Assertion failure in -[NSIndexPath row], /SourceCache/UIKit/UIKit-1914.85/UITableViewSupport.m:2606
2012-08-20 08:39:27.052 Cabrais[1808:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid index path for use with UITableView. Index paths passed to table view must contain exactly two indices specifying the section and row. Please use the category on NSIndexPath in UITableView.h if possible.'
*** First throw call stack:
(0x355ec88f 0x33210259 0x355ec789 0x349e03a3 0x32d4d673 0x35dba49d 0x35dd90e5 0x35dd9379 0x32d4cefb 0x32d4bfd9 0x32d4b763 0x35da7657 0x32ceff37 0x3554b1fb 0x32716aa5 0x327166bd 0x327165c9 0x35dd8179 0x35da936b 0x35dbce65 0x35dbb6b3 0x33979c59 0x33984e91 0x355bf2ad 0x355424a5 0x3554236d 0x332dd439 0x32d1acd5 0x6954 0x3388)
terminate called throwing an exception(lldb)
I have tried disabling notifications through the Ipad/Iphone settings for both my app and GameCenter as well as through the code by removing all notification related code but this hasn't had any effect at all.
I know through debugging that the code in my function attached to GameCenterTurnBasedManager.handleTurnEventEvent doesn't get called before the crash occurs, and neither does the one registered to EtceteraManager.remoteNotificationReceived. (Both these function work perfectly fine otherwise.)
I have asked Prime31 and they have told me that the exception is a mishandling of the tables data source, and to file a bug report with Apple.
Has anyone experienced a similar crash/error while working with Unity?
And is there any way I can try to catch the notification before it arrives and remove the matchmaker or be able to handle the error from unity?
Any insight/help/comments would be greatly appreciated,
Thanks.

Related

AKMicrophone causes SIGABRT error - A bug?

I found a post that has the same error in the same situation here:
https://groups.google.com/forum/#!topic/audiokit/SmyuzPJQ6wU
Same as this poster - I'm using the source. However, at the end of the post the user does not say what he did to fix the issue.
I'm currently using an unaltered "ExtendingAudioKitUsingSource" example as I need to add some functionality to audiokit. (unaltered outside of using my provisioning profile and adding "let m = AKMicrophone()" in ViewController.swift.
I receive these errors:
2018-08-31 15:16:50.684 ExtendingAudioKit[6800:8850964] 15:16:50.683
ERROR: [0x39058000] AVAudioIONodeImpl.mm:452:
___ZN13AVAudioIOUnit9EnableBusEm_block_invoke: error -10849
2018-08-31 15:16:50.688 ExtendingAudioKit[6800:8850964] ***
Terminating app due to uncaught exception
'com.apple.coreaudio.avfaudio', reason: 'error -10849'
which traces back to line 46 in AKMicrophone.swift to init(): AudioKit.engine.connect(AudioKit.engine.inputNode, to: self.avAudioNode, format: nil)
I've had no issues using AKMicrphone() outside of this project.
I have fixed an AKMicrophone bug in AudioKit v4.5.1 that may have fixed this for you. If not, I'll withdraw this answer, but please check it out and let me know.

Facebook SDK 7.4.0 in Unity 5.3 Inviting & Sharing

I have create a unity project and integrated facebookSDK sharing as a given in this tutorial(https://www.youtube.com/watch?v=XDLyYvHdlGM).
This is working fine on unity editor as they show in this tutorial but problem is this it’s not working on my iPod device.
When I click on Login button in iPod device nothing to happen just restart my app and an exception throw in Xcode:
Exception is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Read permissions are not permitted to be requested with publish or manage permissions.'
*** First throw call stack:
(0x219f810b 0x2119ee17 0x219f7e19 0x1150aed 0x8902bf 0x89013b 0x892375
0x11e98f 0x11d34d 0x117557 0x121327 0x58bdfb 0x554179 0x54dd5d
0x79b317 0x5521a3 0x551dff 0x5517f7 0x54d1b7 0x859533 0x10d0aa5
0xa17b99 0xa17b5b 0xa0c555 0x901351 0x9d102d 0xc024eb 0x13105 0x12f05
0x38db9a1 0x23c7c7c3 0x23c7c60f 0x2336757b 0x21c463e9 0x219a9ae9
0x219bbe43 0x219bb557 0x219b9969 0x2190cbf9 0x2190c9e5 0x22b58ac9
0x25b9cba1 0xb8db 0x215bb873) libc++abi.dylib: terminating with
uncaught exception of type NSException
Kindly suggest me what should I do.
Thanks!
I had this same problem. I fixed it by separating my permissions into read & write permission lists. I believe the problem was coming up when I had a single list of permissions and tried to pass "publish_action" into LogInWithReadPermissions. For example:
List<string> Readpermissions = new List<string>();
List<string> Writepermissions = new List<string>();
Readpermissions.Add("public_profile");
Readpermissions.Add("user_friends");
Writepermissions.Add("publish_actions");
FB.LogInWithReadPermissions(Readpermissions, AuthCallBack);
FB.LogInWithPublishPermissions(Writepermissions, AuthCallBack);
edit: This will create a problem of it's own where it will create a second dialogue (log in with publish) before the user logs into the first dialogue (log in with read). Once the permissions are separated, just make sure to request "LogInWithPublishPermissions" in the AuthCallBack of "LogInWithReadPermissions" or anytime once you are logged in.

Why am I getting a `unrecognized selector sent to instance` error?

I have a Ruby on Rails application that has an API, it's an OAuth 2.0 provider and uses Doorkeeper. I am creating an iPhone client for that application and am using the gtm-oauth2 library for authentication. Here is the Github repository for the iPhone app.
I manage do the authentication request using the library and get the response from the OAuth server, but (I think that) when the iPhone app receives the response, the iPhone app crashes. I get the following error:
2013-03-25 07:30:51.563 Catapult for iOS[68917:c07] -[NSNull length]: unrecognized selector sent to instance 0x14f2678
2013-03-25 07:30:51.564 Catapult for iOS[68917:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x14f2678'
*** First throw call stack:
(0x13c1012 0x11e6e7e 0x144c4bd 0x13b0bbc 0x13b094e 0xf074 0x185e3 0x13b51bd 0x13b50d6 0x1531a 0x1512b 0x14ae2 0x13b51bd 0x13b50d6 0x11d0a 0x1032a 0x13b51bd 0x13b50d6 0x79be 0x77ed 0x8cf2 0xcec589 0xcea652 0xceb89a 0xcea60d 0xcea785 0xc37a68 0x4a2a911 0x4a29bb3 0x4a67cda 0x13638fd 0x4a6835c 0x4a682d5 0x4952250 0x1344f3f 0x1344a39 0x1367734 0x1366f44 0x1366e1b 0x22be7e3 0x22be668 0x12affc 0x2c6d 0x2b95)
libc++abi.dylib: terminate called throwing an exception
I am a complete noob/beginner when it comes to iOS development and Objective-C programming, and I am learning how to create my first app using this little project. I asked the same question in the gtm-oaut2 Google Group and according to them, the problem comes from my code and not the library. The problem is that all of my code is taken from their wiki and I can't pinpoint where the app crashes. If I understand correctly, at some point I am calling length of NSNull, but I am not calling length anywhere, hence my confusion. Also, when the app crashes, the line hilighted is in the main.m file and the error (on the right label, not in the output) is the following:
Thread 1: signal SIGABRT
I have no clue what that means...
Does anyone know what the problem might be please?
You're right that the issue is that somewhere you've got the length message being sent to an instance of NSNull. To pinpoint where exactly this is happening set a breakpoint on objc_exception_throw. You can do this in the Xcode UI with little "+" button in the bottom left corner on the breakpoints tab. Select "Add Exception breakpoint." Then the debugger will stop your program at the point where the error occurs instead of waiting for the program to actually crash.
Well... you understood the error correctly.. You are somewhere calling length on a NSNull instance.
I must find out where this is happening.
I think this is happening in a JSON response. Maybe you (or "the code") is calling length on something it expects its a NSString but it is instead NSNull (that is the json has a NULL value).
Try if you manage to print the json response and see if you found a key mapped to a null value...
NSNull does not respond to length
You can check the documentation for NSNull to see that this is the case.
Without having an idea of what your code base is doing I am not sure where to look, you must be calling [NSNull null]; at some point to get the NSNull object or you are using a framework somewhere that returns this.

ZoomingPDFViewer example error

I'm trying to develop an app that can show a PDF file. I try to complete this with ZoomingPDFViewer
http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281-Intro-DontLinkElementID_2
code that is in the apple library. When I mix that code with my code some function doesn't work. And if I make it with the same code (don't mixed) the app throw this error:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setPDFPage:]: unrecognized selector sent to instance 0x6a833f0'
I'm in SDK 5.0 the requirements says that I should compile it in SDK 5.1 but the sample runs perfect, the problem is in my project but I don't know what is my error.
I'll appreciate if someone can help me with this strange error.
Check the Class setting in Storyboard.
View Controller -> Custom Class: ZoomingPDFViewerViewController and
Scroll VIew -> Custom Class: PDFScrollView
The second setting is the cause of your error.
You seem to be sending -setPDFPage: to an uncast self.view object. Try casting before calling like so:
[(PDFScrollView *)self.view setPDFPage:PDFPage];
Double check your connections in IB, if you are using it, or make sure you are initing a PDFScrollView* object in -loadView if not.

XCode4 Debugger Always Breaks in Main

After upgrading to XCode4 (v. 4.2, 4D199) it seems every time my apps crash while debugging, the debugging points to main(), and the stack is unsymbolicated and useless.
This has been working fine for years, I have no idea what has gone wrong.
I'm using GDB. I also tried the LLDB as per this advice, and it didn't work either (similar, useless stack).
My breakpoints work, I get the full stack, and can inspect variables when my code hits those.
Steps to reproduce:
NB. this happens with my own project, but I'll use Apple's code here to remove that variable from the equation
Download the following sample from Apple: https://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007710
In the ImagesViewController class, add the following code to the viewDidLoad method (so it will crash – we want it to crash for this test):
// please note: this code is designed to crash! I want it to crash, to highlight my issue with XCode.
NSMutableArray* test = [NSMutableArray new];
[test insertObject:NULL atIndex:0];
Then run the app & hit the 'Images' row.
It crashes with a message like:
2011-12-23 14:07:02.788 UICatalog[13394:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x37bbb8bf 0x316a11e5 0x37b1020f 0x699f 0x34fac7ff 0x34fb8c39 0x34fb8aa9 0x34fb898f 0x34fb815b 0x34fb7f53 0x34fac673 0x34fac349 0x66c1 0x35026565 0x3509ece7 0x31aec943 0x37b8fa63 0x37b8f6c9 0x37b8e29f 0x37b114dd 0x37b113a5 0x3768ffcd 0x34fa1743 0x2459 0x2418)
terminate called throwing an exception(gdb)
View in xcode:
Thanks to brigadir for pointing me to the solution!
It works well. Here's some screenshots for how to solve this for anyone finding my question:
Tap the plus button of the breakpoints tab
Then click Done

Resources