Gigya is crashing during initialization in Swift project - swift

Does anyone tried to use Gigya with swift?
I've linked Gigya's framework to project, created bridging file and #import there < GigyaSDK/Gigya.h >. While I'm trying init Gigya - I receive exception
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSString GSGUIDString]: unrecognized selector sent to class 0x10a6bbb20'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109e7fe65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c148deb objc_exception_throw + 48
2 CoreFoundation 0x0000000109e8838d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000109dd590a ___forwarding___ + 970
4 CoreFoundation 0x0000000109dd54b8 _CF_forwarding_prep_0 + 120
5 Application 0x00000001094f6063 -[GSRequest initWithSession:method:parameters:useHTTPS:requestTimeout:] + 515
6 Application 0x00000001094f6251 -[GSRequest initWithSession:method:] + 241
7 Application 0x00000001094f5ce3 +[GSRequest requestForMethod:] + 131
8 Application 0x00000001094fd83b -[Gigya getSDKConfig] + 59
9 Application 0x00000001094fc596 +[Gigya initWithAPIKey:application:launchOptions:APIDomain:] + 790
As I checked, this class is Int.
Does anyone know how to solve this problem? Variant with "cut this piece of… Single Sign-On service" doesn't acceptable ;)

Set Linker Flags to -ObjC in Build Settings.

If you want to use Gigya in the Swift project - you must use not Gigya's framework but Gigya's source (You can find both of them here). Just add it to your project and create bridging file, where you should add #import "Gigya.h"

Related

TGAccessoryManager causes argument exception on fireDataReceived

I've been trying to research this error for a while, but to no avail. Every time it looks like TGAccessoryManager should be sending my application data, an argument exception occurs:
2013-04-30 11:46:01.905 mindyieldapp[14537:907] Exception: *** -[NSDictionary initWithDictionary:copyItems:]: dictionary argument is not an NSDictionary
2013-04-30 11:46:01.918 mindyieldapp[14537:907] Stack trace: (
0 CoreFoundation 0x33d7f2bb <redacted> + 186
1 libobjc.A.dylib 0x3ba2497f objc_exception_throw + 30
2 CoreFoundation 0x33d0bff5 <redacted> + 212
3 mindyieldapp 0x000c1539 -[TGAccessoryManager fireDataReceived:] + 336
I'm certain my code is wired up correctly, as I've stripped it down significantly, and the accessoryDidConnect/accessoryDidDisconnect selectors are being called. I'm targeting iOS 6.1, with the latest version of the Neurosky SDK (I just re-downloaded to be sure). Any assistance is appreciated.
The error is quite clear, copyItems is not an instance of NSDicitonary. Put a breakpoint on
the line with [NSDictionary initWithDictionary:copyItems:] and see of what type is copyItems instance of.

CrashReport from Hockey, awkward Stacktrace with NSPlaceholderDictionary

got some strange stack trace from an app i developed. here the stack trace:
Exception Type: SIGTRAP
Exception Codes: #0 at 0x312b1848
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]:
attempt to insert nil object from objects[0]'
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x35c48848 __kill + 8
1 CoreFoundation 0x34dba957 __handleUncaughtException + 75
2 libobjc.A.dylib 0x361e1345 _objc_terminate + 129
3 libc++abi.dylib 0x000043c5 safe_handler_caller(void (*)()) + 77
4 libc++abi.dylib 0x00004451 operator delete(void*) + 1
5 libc++abi.dylib 0x00005825 __cxa_current_exception_type + 1
6 libobjc.A.dylib 0x361e12a9 objc_exception_rethrow + 13
7 CoreFoundation 0x34d1050d CFRunLoopRunSpecific + 405
8 CoreFoundation 0x34d1036d CFRunLoopRunInMode + 105
9 GraphicsServices 0x36f85439 GSEventRunModal + 137
10 UIKit 0x32df5cd5 UIApplicationMain + 1081
11 myApp 0x000073f9 main (main.m:42)
this happens when you click on a tableview and a view should be pushed on the navigation controller. i never get this bug reproduced, so i could not say precisely, when it happened.
it could be that only iOS 5.1.1 is affected (only crash reports from this version exists).
i always check objects before adding them to a dict, so could loading xibs be a reason for that? perhaps it is kind of damaged, i recognized that sometimes xibs are in a very strange way...
thanks for every help
If your crash reporter isn't reporting the exception backtrace, it needs to be fixed. Exceptions on the main thread have been caught and "re-thrown" (hence objc_exception_rethrow) since iOS 5 (nearly a year ago!).
I think __NSPlaceholderDictionary is just what you get by calling [NSDictionary alloc]. I suspect the culprit is code that does [NSDictionary dictionaryWithObject:x forKey:#"foo"] without checking that x is non-nil.
iTunes Connect's crash reporting may also be helpful, though they display a very small subset of actual crashes.

How to read Xcode console output?

As a Java and PHP developer new to Xcode, I am having trouble dealing with memory errors. I have a sample program from a book, which crashes on startup with "Program received signal 'SIGABRT'." I don't know what to do with the console output below. I realize it's some kind of stack trace, but the name on the left is just the name of the application, not a class or file. I don't know what "main + 121" or "start + 53" means or where to look. Any guidance would be appreciated.
2011-05-11 10:43:23.071 FlowerInfoNavigator[22537:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary objectForKey:]: method sent to an uninitialized mutable dictionary object'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00dbf542 -[__NSPlaceholderDictionary objectForKey:] + 194
3 FlowerInfoNavigator 0x0000289a -[RootViewController tableView:didSelectRowAtIndexPath:] + 330
4 UIKit 0x0008bb68 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
5 UIKit 0x00081b05 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
6 Foundation 0x0079b79e __NSFireDelayedPerform + 441
7 CoreFoundation 0x00da38c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
8 CoreFoundation 0x00da4e74 __CFRunLoopDoTimer + 1220
9 CoreFoundation 0x00d012c9 __CFRunLoopRun + 1817
10 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
11 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
12 GraphicsServices 0x00ffa1c4 GSEventRunModal + 217
13 GraphicsServices 0x00ffa289 GSEventRun + 115
14 UIKit 0x00022c93 UIApplicationMain + 1160
15 FlowerInfoNavigator 0x00001b99 main + 121
16 FlowerInfoNavigator 0x00001b15 start + 53
)
terminate called after throwing an instance of 'NSException'
(gdb)
On the right are the methods that were called that are on the stack. I generally just look for anything that is from one of my methods (though this won't always work) and then it'll give you the method call that the problem originated from. in the trace at call number 3 on "FlowerInfoNavigator" the method tableView:didSelectRowAtIndexPath: was called and somewhere in there is what caused the crash. You should be able to use the debugger and breakpoints to narrow it down from there hopefully. Good luck.
Edit: as I relooked at your error message: at the top of it it gives you the error. You tried to retrieve an object from a NSDictionary that wasn't initialized yet, and from above, it occurred in your didSelectRowAtIndexPath method
The console wouldn't be the only place you look. Take a look at your Debugger too. Over there there is usually one line that is bolded. If you tap that it'll show you exactly where the crash happened.
Looks like you didn't init your NSDictionary
The Crash is due to nsdictionary is not initialized yet and how to search for during a crash ,first look at console so you will get idea about what caused the crash or exception and to get where the application crashed you can check out debugger .In the debugger the the particlar line will be in bold where the application crashed.
Apart from you can also use NSZombieEnabled (BOOL) to get what is causing the application crash .More about NSZombieEnabled can be found here http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/130-Debugging_Applications/debugging_applications.html
Note : here do make sure to make NSZombieEnabled set to NO at time of processing the application to submission to apple store.
Hope this helps.

Unrecognized selector on calling Google Toolbox for Mac NSString category method in iOS

I'm building a static library for use in an iOS project, and I want to decode XML entities returned from a web service. I've grabbed Google Toolbox for Mac and added the following files to my project:
GTMDefines.h
GTMNSString+HTML.h
GTMNSString+HTML.m
Then in my own .m file I'm doing this:
#import "GTMNSString+HTML.h"
// then in one of my methods:
NSString *value = [anotherNSStringValue gtm_stringByUnescapingFromHTML];
The code compiles fine, but when I run the app that uses my static library it crashes with a NSInvalidArgumentException, complaining that the gtm_stringByUnescapingFromHTML selector isn't recognised for NSString:
2011-02-10 12:21:38.401 MyApp[20356:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString gtm_stringByUnescapingFromHTML]: unrecognized selector sent to instance 0x71403e0'
*** Call stack at first throw:
(
0 CoreFoundation 0x0111bbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x012705c2 objc_exception_throw + 47
2 CoreFoundation 0x0111d6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x0108d366 ___forwarding___ + 966
4 CoreFoundation 0x0108cf22 _CF_forwarding_prep_0 + 50
5 MyApp 0x00028dcf -[GSMyAppXMLParser parseData:] + 714
// Rest of stack trace removed
)
terminate called after throwing an instance of 'NSException'
I've found a few similar issues on Stack Overflow, and in each case the questioner has subsequently commented that they fixed it by tweaking a linker setting - but without disclosing which setting! If anyone can help me with this I'd be forever grateful!
I’m guessing that would be the -ObjC and -all_load flags.
You add these to the ‘Other Linker Flags’ of the app that links agains the library, not the library itself.
For more info see: http://developer.apple.com/library/mac/#qa/qa2006/qa1490.html

iPhone App Crashing during navigation

I have a tough problem (tough for me since I'm a newb.). I have a table view app that I'm working on. It starts with a table and you navigate down to a view controller. In that view controller I'm using some sample code hooked into a button that will add a contact to the iPhone address book.
My problem is when the user navigates back to the table of data, the app crashes. Is there any advice someone can provide? Or, maybe someone I could send me code for review?
Update*
Here's the information from the console.
[Session started at 2010-07-20 22:51:46 -0500.]
2010-07-20 22:51:49.621 Infinite Possibilities[5882:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument'
*** Call stack at first throw:
(
0 CoreFoundation 0x025ff919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0274d5de objc_exception_throw + 47
2 CoreFoundation 0x025b8078 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x025b7fea +[NSException raise:format:] + 58
4 Foundation 0x0006869c -[NSPlaceholderString initWithString:] + 105
5 Infinite Possibilities 0x00003b90 -[RootViewController tableView:didSelectRowAtIndexPath:] + 3405
6 UIKit 0x0034c718 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
7 UIKit 0x00342ffe -[UITableView _userSelectRowAtIndexPath:] + 219
8 Foundation 0x00059cea __NSFireDelayedPerform + 441
9 CoreFoundation 0x025e0d43 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
10 CoreFoundation 0x025e2384 __CFRunLoopDoTimer + 1364
11 CoreFoundation 0x0253ed09 __CFRunLoopRun + 1817
12 CoreFoundation 0x0253e280 CFRunLoopRunSpecific + 208
13 CoreFoundation 0x0253e1a1 CFRunLoopRunInMode + 97
14 GraphicsServices 0x02e642c8 GSEventRunModal + 217
15 GraphicsServices 0x02e6438d GSEventRun + 115
16 UIKit 0x002e8b58 UIApplicationMain + 1160
17 Infinite Possibilities 0x00002834 main + 102
18 Infinite Possibilities 0x000027c5 start + 53
)
terminate called after throwing an instance of 'NSException'
Usually a crash means you have some sort of memory problem or calling a undefined function(sending a message that is not answered by the receiver).
Are trying to read from a pointer to an object that was released already?
Are you trying to send a message to an object that is not answering to it?
The good news is that you have a lot of good tools to find out exactly what it is:
First of all, open the console (Shift + Command R) and see if there is a message or stack trace when your app crashes. If there is no message, run the debugger (Shift + Command Y) and see where it stops on the crash.
Finally, if you see the status bar of XCode, it will tell you a bit of information about the crash (the message that was send about the crash, could be a EXEC_BAD_ADDRESS or some other thing.
Sadly, without your code or any of this information this is all I can do to help you. I would suggest not only copy and pasting but really understanding what that code is supposed to be doing and also learning how to debug your code.
For good resources I would recommend the Itunes U Standford Iphone development class and/or reading a good book about it(I read the Head First Iphone book and I love the series but didn't really like this one).