yandexmobile / metrica-sdk-ios

AppMetrica is a free real-time ad tracking and mobile app analytics solution.
https://tech.yandex.com/metrica-mobile-sdk/
Other
73 stars 15 forks source link

Crash in reportError #6

Closed fanruten closed 10 years ago

fanruten commented 10 years ago
                NSException *exception = [NSException exceptionWithName:@"Exception"
                                                                 reason:[NSString stringWithFormat:@"Empty info for obj with id == %@", obj.id]
                                                               userInfo:nil];
                [YMMCounter reportError:@"Error" exception:exception failure:nil]

0 0x37b9e6a0 in objc_exception_throw ()

1 0x2d77fa1e in -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]()

2 0x2d77f7e2 in +[NSDictionary dictionaryWithObjects:forKeys:count:]()

3 0x000e1188 in -[YMMException decodedException] at /Users/teamcity/BuildAgents/1/work/a9eac767529ff2ec/YandexMobileMetrica/YandexMobileMetrica/YMMException.m:61

4 0x000eb0cc in -[YMMSession reportError:exception:failure:] at /Users/teamcity/BuildAgents/1/work/a9eac767529ff2ec/YandexMobileMetrica/YandexMobileMetrica/YMMSession.m:332

5 0x000e8234 in -[YMMReporter reportError:exception:failure:] at /Users/teamcity/BuildAgents/1/work/a9eac767529ff2ec/YandexMobileMetrica/YandexMobileMetrica/YMMReporter.m:212

6 0x000e5a28 in -[YMMCounterImpl reportError:exception:failure:] at /Users/teamcity/BuildAgents/1/work/a9eac767529ff2ec/YandexMobileMetrica/YandexMobileMetrica/YMMCounterImpl.m:122

7 0x000dec08 in +[YMMCounter reportError:exception:failure:] at /Users/teamcity/BuildAgents/1/work/a9eac767529ff2ec/YandexMobileMetrica/YandexMobileMetrica/YMMCounter.m:171

ashender commented 10 years ago

Hello! Thank you for using our library and for your feedback! We will fix this issue in the next release. For now we may advise to pass all information in error message or use a real 'caught' exception, so that it has stacktrace. Like in following code: @try { NSException exception = [NSException exceptionWithName:@"Exception" reason:[NSString stringWithFormat:@"Empty info for obj with id == %@", obj.id] userInfo:nil]; [exception raise]; } @catch (NSException exception) { [YMMCounter reportError:name exception:exception failure:nil]; }

Or if just error string needed to be reported:

NSString *errorStr = [NSString stringWithFormat:@"Empty info for obj with id == %@", obj.id]; [YMMCounter reportError:errorStr exception:nil failure:nil];

yvasileuski commented 10 years ago

Fixed in version 1.2.3