pocketsmith / nativescript-raygun

A NativeScript plugin for Raygun error reporting.
MIT License
2 stars 2 forks source link

Trying to add extra data on iOS #4

Open AntonioCuevaUrraco opened 8 years ago

AntonioCuevaUrraco commented 8 years ago

So I figured out with the guys of NS how to catch the NS error and the stack trace so I want to add those to the crash on iOS so they are more detailed.

Raygun has this methods for iOS

/**
  Manually send an exception to Raygun with the current state of execution.
  warning backtrace will only be populated if you have caught the exception
 */
- (void)send:(NSException *)exception;

/**
 Manually send an exception to Raygun with the current state of execution and a list of tags.

 @warning backtrace will only be populated if you have caught the exception
 */
- (void)send:(NSException *)exception withTags:(NSArray *)tags;

/**
 Manually send an exception to Raygun with the current state of execution, a list of tags and a dictionary of custom data.

 @warning backtrace will only be populated if you have caught the exception
 */
- (void)send:(NSException *)exception withTags:(NSArray *)tags withUserCustomData:(NSDictionary *)userCustomData;

/**
 Manually send an exception name and reason to Raygun with the current state of execution, a list of tags and a dictionary of custom data.
 */
- (void)send:(NSString *)exceptionName withReason: (NSString *)exceptionReason withTags: (NSArray *)tags withUserCustomData: (NSDictionary *)userCustomData;

/**
 Manually send an error to Raygun with the current state of execution, a list of tags and a dictionary of custom data.
 */
- (void)sendError:(NSError *)error withTags:(NSArray *)tags withUserCustomData:(NSDictionary *)userCustomData;

So I am trying to use them but I always end up on crash with something like -[_NSObserverList UTF8String]: unrecognized selector sent to instance

This is what I tried:

raygun.sendExtraData = function(val) {
    this._checkIfRunning();

    var utils = require("utils/utils");
    var string= NSString.alloc().initWithString("something");

    var dictionary= NSDictionary.dictionaryWithDictionary({
                                                         Key1: '.mp3',
                                                         Key2: 16,
                                                         Key3: 44100,
                                                         Key4: 2,
                                                         });

    var array = utils.ios.collections.jsArrayToNSArray(["string", "string"]);
    var error= NSError.errorWithDomainCodeUserInfo(string, 200, dictionary);

    this._getReporter().sendErrorWithTagsWithUserCustomData(error, array, dictionary);
};

Also I tried some other of the raygun methods to send, to send null instead of the objects and to send "string" instead of creating a NSString

Do you have some idea how to fix this issue? with this on place we could say raygun is a complete crash report tool working on nativescript

maknz commented 8 years ago

You might have a string where a number was needed, or a number where a string was needed. I've encountered a similar error when I was using an integer where a string was expected, or something like that.

AntonioCuevaUrraco commented 8 years ago

No luck, I changed all I could think off. Also I tried.

    var string=NSBundle.mainBundle().bundlePath; //Try to make sure is a NSString
    var dictionary= NSDictionary.dictionaryWithDictionary({
                                                         Key1: '.mp3',
                                                         });

    var exception = NSException.exceptionWithNameReasonUserInfo(string,string,dictionary);

    this._getReporter().send(exception);

-[__NSCFType UTF8String]: unrecognized selector sent to instance 0x7fd72c139400

My idea right now is that it has noting to do with the string, the array, the dictionary, the error or the exception. All the manual report methods are trying to grab something from the app on their code and that thing make it crash on NS and if it is so the raygun guys are the ones that have to figure it out

AntonioCuevaUrraco commented 8 years ago

@maknz I will be using https://github.com/AntonioCuevaUrraco/nativescript-logEntries since I can not get the extra data to work on raygun. And I will reconsider raygun if we get this one done someday