bugfender / BugfenderSDK-iOS

Bugfender SDK for iOS, a remote logger tailor-made for mobile
https://bugfender.com
Other
76 stars 30 forks source link

BFObjectIdentifier toData: unrecognized selector #9

Closed jyounus closed 9 years ago

jyounus commented 9 years ago

Hey,

How about open sourcing the code instead of just a compiled SDK? Would be great for me to debug an issue I'm having in Swift 2.0 and Xcode 7. The sample project in your other repo (after my pull request) works fine. But if I integrate it into my own project using Cocoapods, I get the following crash:

2015-10-09 13:56:24.184 TestProject[51890:646959] -[BFObjectIdentifier toData]: unrecognized selector sent to instance 0x7fc61a17e6a0
2015-10-09 13:56:24.369 TestProject[51890:646959] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BFObjectIdentifier toData]: unrecognized selector sent to instance 0x7fc61a17e6a0'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000106635f65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010807edeb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010663e58d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010658bf7a ___forwarding___ + 970
    4   CoreFoundation                      0x000000010658bb28 _CF_forwarding_prep_0 + 120
    5   Matcher                             0x0000000105c8847d -[BFIssueManager sendIssuesWithSessionIdentifier:] + 45
    6   Matcher                             0x0000000105c7187d -[BFStorageItem bgf_sendLogsWithCompletionBlock:] + 184
    7   Matcher                             0x0000000105c7126d __41-[BFStorageItem sendWithCompletionBlock:]_block_invoke_3 + 136
    8   libdispatch.dylib                   0x0000000109358ef9 _dispatch_call_block_and_release + 12
    9   libdispatch.dylib                   0x000000010937949b _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x0000000109361c8b _dispatch_root_queue_drain + 1829
    11  libdispatch.dylib                   0x0000000109361561 _dispatch_worker_thread3 + 111
    12  libsystem_pthread.dylib             0x00000001096aa4f2 _pthread_wqthread + 1129
    13  libsystem_pthread.dylib             0x00000001096a8375 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I have no idea what the issue is or how to debug it since I don't have access to the source code. Any ideas what the issue may be? I'm literally just using this in my AppDelegate:

Bugfender.activateLogger("*my key here*")

let string = Bugfender.deviceIdentifier();
NSUserDefaults.standardUserDefaults().setObject(string, forKey: "device_id")

BFLog("#######################")
BFLog("")

BFLog("Test log! :D")

Thanks

jgimenez commented 9 years ago

Hi @jyounus , we'll look into it.

jyounus commented 9 years ago

Okay, thanks. I managed to narrow the issue down to this line of code:

Bugfender.activateLogger("xxx")

I've commented the rest of the code out, as soon as that line is uncommented, it crashes on start up in the simulator. (I obviously replaced my app key)

jgimenez commented 9 years ago

Hi @jyounus if it works with the demo app, the problem must be probably somewhere in your project configuration. If you'd be able to create a small proof of concept and send it over would be awesome. You can put them here or send them privately to support@bugfender.com

jyounus commented 9 years ago

I just created a brand new project and added the pod files. Still the same issue. I emailed you a zipped up project with my app key included in there.

Let me know if you can reproduce it now.

Thanks for looking into this.

jgimenez commented 9 years ago

It looks like it's a CocoaPods bug that results in Objective-C categories not loading. Updating to the latest CocoaPods RC version fixes the problem.

To do so just run gem install cocoapods --pre (or sudo gem install cocoapods --pre depending on your configuration).

jyounus commented 9 years ago

Awesome, that seems to have fixed the issue for me!

Thanks a lot, appreciate it! :D

jgimenez commented 9 years ago

You're welcome!

jgimenez commented 9 years ago

Just for future reference if other people come by with the same problem, CocoaPods stable version 0.39.0 has been released with the fix.

gem install cocoapods (or sudo gem install cocoapods) will make it work