Reputation: 1307
Hello everyone I deployed an update for my app and few users have complained/bad reviews etc of app shutting down on them.
One user sent me a crash report and I have re-symbolicated it and it has shown the method where it is crashing and the line number.
I have tried many possible solutions but for the life of me I cannot reproduce it on my device.
Could anyone please be kind and let me know what could be the problem in the following code that is crashing the app:
The line no it is crashing is m:555 i.e
NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName: font}];
I am not sure what the issue is, I have tried passing @"" empty as content still it doesn't crashes.
-(CGFloat)getCellHeightForContent:(NSString*)content
{
NSString *text = content;
CGFloat width = self.tableview.frame.size.width - 15 - 30 - 15; //tableView width - left border width - accessory indicator - right border width
UIFont *font = [UIFont systemFontOfSize:17];
NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName: font}];
CGRect rect = [attributedText boundingRectWithSize:(CGSize){width, CGFLOAT_MAX}
options:NSStringDrawingUsesLineFragmentOrigin
context:nil];
CGSize size = rect.size;
size.height = ceilf(size.height);
size.width = ceilf(size.width);
if ((size.height )+ 5 < 70) {
return 70;
}
return size.height + 15;
}
here is the crash report
Incident Identifier: CAB2B27B-F65F-4F8A-82C6-C1AECD791335
CrashReporter Key: 759ffd08fa781ee7b8ae9515835758c563110d7f
Hardware Model: iPhone5,1
Process: xxxx [9226]
Path: /var/mobile/Applications/AA5E7A52-ED1E-421F-B377-CF32D55E71EA/xxxx.app/xxxx
Identifier: com.xxxx.xxxx
Version: 7.0.1 (7.0.1)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2014-06-18 22:09:44.336 -0400
OS Version: iOS 7.1.1 (11D201)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x2e33bf06 0x2e267000 + 872198
1 libobjc.A.dylib 0x38ad2ce2 0x38acf000 + 15586
2 CoreFoundation 0x2e33be48 0x2e267000 + 872008
3 Foundation 0x2ec72bd0 0x2ec57000 + 113616
4 Foundation 0x2ec72aac 0x2ec57000 + 113324
5 xxxx 0x00073850 -[DetailVC getCellHeightForContent:] (DetailVC.m:555)
6 xxxx 0x000725b4 -[DetailVC tableView:heightForRowAtIndexPath:] (DetailVC.m:382)
7 UIKit 0x30c7b1ae 0x30b60000 + 1159598
8 UIKit 0x30c3fd92 0x30b60000 + 916882
9 UIKit 0x30c41b6c 0x30b60000 + 924524
10 UIKit 0x30c41ac0 0x30b60000 + 924352
11 UIKit 0x30c416ba 0x30b60000 + 923322
12 xxxx 0x00070c4c -[DetailVC viewDidLoad] (DetailVC.m:157)
13 UIKit 0x30b6fa4e 0x30b60000 + 64078
14 UIKit 0x30b6f80c 0x30b60000 + 63500
15 UIKit 0x30cfbc0e 0x30b60000 + 1686542
16 UIKit 0x30c1948a 0x30b60000 + 758922
......
Thank you in advance for your help!!
Upvotes: 0
Views: 115
Reputation: 15329
Since the crash report is not fully symbolicated and the exception reason is not shown in the report, the following is only an assumption:
You are saying line 555 references this code:
NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName: font}];
This causing an exception could be because text
is nil
.
You should really try to get a fully symbolicated crash report. This requires your Mac to have the iOS symbols of iOS 7.1.1 of armv7s or armv7. You get those symbols by connecting an iPhone 5 or iPad 3 with iOS 7.1.1 running to your Mac. If you can't do that, provide the full crash report somewhere and I'll symbolicate it for you this one time.
Even better if you get a crash report that also shows the exception reason, but usually Apple reports do not contain that, so it might be helpful to integrate a 3rd party crash reporting functionality into your app. (Don't ask for recommendations since I am biased and most answers will also be biased, rather test them yourself and choose wisely).
Upvotes: 2