滚动 UITableview 时发生崩溃

Posted

技术标签:

【中文标题】滚动 UITableview 时发生崩溃【英文标题】:Crash happening while Scrolling the UITableview 【发布时间】:2017-08-11 11:09:01 【问题描述】:

当我使用泰卢固语脚本滚动 tableview 时,我的应用程序在 main.m @autoreleasepool 中获得 EXC_BAD_ACCESS,并且仅在 ios 9 中而不是在 iOS 10 中,我也尝试在 iOS 8 中使用模拟器,但它也没有,并且当我使用英语/泰米尔语脚本时,它不会崩溃。

另外,我在控制台中没有收到任何崩溃日志,我尝试使用 NSZombieEnbled 获取日志,是的,然后在仪器中哪个僵尸对象导致崩溃,我没有得到任何线索,例如导致崩溃的代码块/代码行,所以我在下面发布我的 uitableview 和 uitableviewcell 代码

在 CustomTableView.m 中

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
    return 1; 


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
    return synopsisArray.count;


-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath 
    return UITableViewAutomaticDimension;


- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath 
    return UITableViewAutomaticDimension;


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    static NSString *cellIdentifier = @"HomeViewCardCell";
    HomeViewCardCell *cell = (HomeViewCardCell *)[tableview dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) 
        cell = [[HomeViewCardCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    
    font = [[NSUserDefaults standardUserDefaults] valueForKey:@"fontsize"];
    [cell setdata:[synopsisArray objectAtIndex:indexPath.row]];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.delegate = self;
    return cell;


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    [moveToTopBtn removeFromSuperview];
    NSString *tabedtag = [[NSUserDefaults standardUserDefaults] objectForKey:@"tabedtagNub"];
    if ([tabedtag isEqualToString:@"0"]) 
        int btnNum = (int)indexPath.row+1;
        NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:btnNum inSection:0];
        if (synopsisArray.count > btnNum) 
            [self.tableview scrollToRowAtIndexPath:myIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
        
    
    if ([tabedtag isEqualToString:@"1"]) 
    scrolposindex = @"0";
        [[NSUserDefaults standardUserDefaults] setObject:scrolposindex forKey:@"scrolposindex"];
        NSString *catname = [[synopsisArray objectAtIndex:indexPath.row] valueForKey:@"categoryName"];
        [[NSUserDefaults standardUserDefaults] setObject:@"YES" forKey:@"categoryButtonPressed"];
        [_delegate pushCategoryScreen:catname categoryID:[[synopsisArray objectAtIndex:indexPath.row] valueForKey:@"categoryID"] entryID:nil];
    
    if ([tabedtag isEqualToString:@"2"]) 
        [moveToTopBtn removeFromSuperview];
        [[NSUserDefaults standardUserDefaults]setInteger:indexPath.row forKey:@"cattapeindex"];
        SynopsisTable *synoptable=[synopsisArray objectAtIndex:indexPath.row];
        [_delegate pushReadWebviewScreen:synoptable.externalURL navbarTitle:synoptable.Source];
    
    if ([tabedtag isEqualToString:@"3"]) 
        AppDelegate *appdelegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
        [appdelegate startActivity];
        NSArray *itemsToShare;
        SynopsisTable *synoptable=[synopsisArray objectAtIndex:indexPath.row];
        itemsToShare = @[[NSURL URLWithString:synoptable.shareUrl]];
        [_delegate presentShareContentView:itemsToShare];
    
    [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"tabedtagNub"];


-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
    cell.backgroundColor = [UIColor clearColor];
    indexNumber = indexPath.row;
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) 
        [cell setLayoutMargins:UIEdgeInsetsZero];
    


- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView 
    lastContentOffset = scrollView.contentOffset;


- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate 
    if (lastContentOffset.y < scrollView.contentOffset.y) 
        [moveToTopBtn removeFromSuperview];
        [_delegate newArticlemsghideshow:YES];
        [UIView animateWithDuration:0.5 delay:0.0     options:UIViewAnimationOptionCurveEaseIn animations:^moveToTopBtn.alpha =    0.0; completion:nil];
     else if (lastContentOffset.y > scrollView.contentOffset.y) 
        [UIView animateWithDuration:0.5 delay:0.1 options:UIViewAnimationOptionCurveEaseIn animations:^moveToTopBtn.alpha = 1.0; completion:nil];
        [self toptomovebutncreate];
        [_delegate newArticlemsghideshow:NO];
    


- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)offset 
    if (offset->y+scrollView.frame.size.height > scrollView.contentSize.height - 1) 
            NSLog(@"tableview load more happened");
            [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"ReloadCategoryVC"];
            [[NSUserDefaults standardUserDefaults] setObject:@"NO" forKey:@"RequestFromTimer"];
            [[NSUserDefaults standardUserDefaults] setObject:@"no" forKey:@"tabedmenu"];
            SynopsisTable *synoptable = [synopsisArray lastObject];
            [_delegate tableViewLodeMore:synoptable.entryID];
    

在 HomeViewCardCell.h 中

@interface HomeViewCardCell : UITableViewCell <UIWebViewDelegate> 
NSString *BGColor;
NSString *TextColor;
SDImageCache *imageCache;
UIWebView *videoWebView;
IBOutlet UILabel *splittext;


@property (nonatomic,retain) IBOutlet UIButton *nextcartbtn;
@property (nonatomic,retain) IBOutlet UIButton *catnamebtn;
@property (nonatomic,retain) IBOutlet UIButton *readmorebtn;
@property (nonatomic,retain) IBOutlet UIButton *sharebtn;
@property (nonatomic,retain) IBOutlet UILabel *titlelab;
@property (nonatomic,retain) IBOutlet UIImageView *logoimg;
@property (nonatomic,retain) IBOutlet UILabel *datelab;
@property (nonatomic,retain) IBOutlet UIView *boarderview;
@property (nonatomic,retain) IBOutlet UIView *placeholderview;
@property (nonatomic,strong) IBOutlet UIImageView * imageview;
@property (nonatomic,retain) IBOutlet UIButton *downloadButton;
@property (nonatomic,strong) NSString *catnameNo;
@property (nonatomic,assign) id delegate;
@property (nonatomic,retain) NSArray *entryidarray;
@property (nonatomic,retain) NSString *textcolor;

-(void)updateFonts;
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier;
-(void)setdata:(NSDictionary *)syntable;
-(IBAction)loadImageView:(NSString *)entryId;

@end

在 HomeCardViewCell.m 中

@implementation HomeViewCardCell 
    NSString *imgStr;
    NSNumber *fontNo;


@synthesize imageview,downloadButton,nextcartbtn,catnamebtn,readmorebtn,sharebtn,titlelab,logoimg,datelab,boarderview,placeholderview,imageView,catnameNo;

-(id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) 
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return self;


- (void)setSelected:(BOOL)selected animated:(BOOL)animated 
    [super setSelected:selected animated:animated];
      // Configure the view for the selected state


-(void)setdata:(NSDictionary *)syntable 
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    [videoWebView removeFromSuperview];
    downloadButton.hidden = YES;
    BGColor = [SaveGetValue getValue:@"BGColor"];
    TextColor = [SaveGetValue getValue:@"TxtColor"];
    fontNo = [[NSUserDefaults standardUserDefaults] valueForKey:@"fontsize"];
    imgStr = [syntable valueForKey:@"entryImgURL"];
    NSString *datetime = [syntable valueForKey:@"entryPublishTime"];
    NSString *categoryName = [syntable valueForKey:@"categoryName"];
    if (![[syntable valueForKey:@"embedCode"] isEqualToString:@""]) 
        imageview.image = nil ;
       NSString *baseUrl = [NSString stringWithFormat:@"http://www.youtube.com/watch?v=%@",[syntable valueForKey:@"embedCode"]];
        NSURL *url = [NSURL URLWithString:baseUrl];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        videoWebView = [[UIWebView alloc] initWithFrame:imageview.frame];
        [videoWebView loadRequest:request];
        [videoWebView setNeedsLayout];
        videoWebView.delegate=self;
        [videoWebView setAllowsInlineMediaPlayback:YES];
        videoWebView.mediaPlaybackRequiresUserAction = YES;
        videoWebView.scrollView.scrollEnabled = NO;
        videoWebView.scrollView.bounces = NO;
        [self.contentView addSubview:videoWebView];
     else 
        videoWebView = nil;
        imgStr = [imgStr stringByReplacingOccurrencesOfString:@"300x80" withString:@"748x80"];
        imageCache = [[SDImageCache alloc] initWithNamespace:@"ImageCacheFolder"];
              dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
            [imageCache queryCacheOperationForKey:[syntable valueForKey:@"entryID"] done:^(UIImage *image, NSData *data, SDImageCacheType cacheType) 
                if (image) 
                    downloadButton.hidden = YES;
                    [imageview setImage:image];
                 else 
                    NSString *currentNetwork = [[NSUserDefaults standardUserDefaults] objectForKey:@"CurrentNetwork"];
                    NSArray *downloadNetworks = [[NSUserDefaults standardUserDefaults] objectForKey:@"DownloadNetworks"];
                    if (([[downloadNetworks objectAtIndex:0] isEqualToString:@"SwitchUp"] && [currentNetwork isEqualToString:@"Wifi"]) || ([[downloadNetworks objectAtIndex:1] isEqualToString:@"SwitchUp"] && [currentNetwork isEqualToString:@"4G"]) || ([[downloadNetworks objectAtIndex:2] isEqualToString:@"SwitchUp"] && [currentNetwork isEqualToString:@"3G"]) || ([[downloadNetworks objectAtIndex:3] isEqualToString:@"SwitchUp"] && [currentNetwork isEqualToString:@"2G"])) 
                        [self loadImageView:[syntable valueForKey:@"entryID"]];
                      else 
                        downloadButton.hidden = NO;
                        downloadButton.frame = CGRectMake(width/2.25, width/4.2, downloadButton.frame.size.width, downloadButton.frame.size.height);
                        downloadButton.tag = [[syntable valueForKey:@"entryID"] integerValue] ;
                        [downloadButton setImage:[UIImage imageNamed:[NSString stringWithFormat:@"download_icon"]] forState:UIControlStateNormal];
                        [downloadButton addTarget:self action:@selector(handleTapFrom:) forControlEvents:UIControlEventTouchUpInside];
                        [imageview sd_setImageWithURL:nil placeholderImage:[UIImage imageNamed:[NSString stringWithFormat:@"PlaceholderImage-Day"]] options:SDWebImageRefreshCached];
                        [imageview addSubview:downloadButton];
                    
                
            ];
        );
    
    // Title Label
    titlelab.text = [syntable valueForKey:@"entryTitle"];
    titlelab.textColor = [UIColor getUIColorFromHex:[SaveGetValue getValue:@"TxtColor"] alpha:1.0];
    titlelab.font = [UIFont systemFontOfSize:fontNo.floatValue+2];

    // Content Label
    NSString *exDesc = [[syntable valueForKey:@"extraDesc"] stringByReplacingOccurrencesOfString:@"<li style='line-height:30px;'>" withString:@""];
    NSArray *splitArray = [exDesc componentsSeparatedByString:@"</li>"];
    splitArray = [splitArray filteredArrayUsingPredicate:
              [NSPredicate predicateWithFormat:@"length > 0"]];
    NSString *appendedStr = @"";
    for (int i = 0; i < splitArray.count; i++) 
        NSString *str = [splitArray objectAtIndex:i];
        str = [str stringByReplacingOccurrencesOfString:@"<li>" withString:@""];
        NSString *bulletPoint = @"  •";
        NSString *formattedString = [NSString stringWithFormat:@"%@ %@ \n",bulletPoint,str];
        appendedStr = [appendedStr stringByAppendingString:formattedString];
    
    splittext.font = [UIFont fontWithName:@"Roboto-Regular" size:fontNo.floatValue];
    splittext.textColor = [UIColor getUIColorFromHex:[SaveGetValue getValue:@"TxtColor"] alpha:1.0];
    splittext.text = appendedStr;

    // Category Button Enable/Disable
    NSInteger catagoryindex = [[[NSUserDefaults standardUserDefaults] objectForKey:@"catagoryIndex"] integerValue];
    if (catagoryindex == 0 || catagoryindex == 1) 
        if ([catnameNo isEqualToString:@"catnameNo"]) 
            categoryName = [NSString stringWithFormat:@" %@",datetime];
            datelab.text = categoryName;
         else 
            categoryName = [NSString stringWithFormat:@"     %@    ",categoryName];
            datelab.text = [NSString stringWithFormat:@" - %@",datetime];
            [catnamebtn setTitle:[categoryName capitalizedString] forState:UIControlStateNormal];
        
     else 
        datelab.text=[NSString stringWithFormat:@" %@",datetime];
    
    NSString *nextcardIcon;
    NSString *ShareIcon;
    NSString *boarderline;
    NSString *logoimage;
    NSString *bgcolor;
    if ([BGColor isEqualToString:@"#404040"]) 
        ShareIcon = [NSString stringWithFormat:@"ShareIcon-Night"];
        nextcardIcon = [NSString stringWithFormat:@"NextCardIcon-Nigt"];
        logoimage = [NSString stringWithFormat:@"60Sec-nightmode"];
        bgcolor = [NSString stringWithFormat:@"#2b2b2b"];
        //2b2b2b 3b3b3b
        boarderline = [NSString stringWithFormat:@"#2e2e2e"];
     else 
        nextcardIcon = [NSString stringWithFormat:@"NextCardIcon-Day"];
        ShareIcon = [NSString stringWithFormat:@"ShareIcon-Day"];
        logoimage = [NSString stringWithFormat:@"60Sec-icon-daymode"];
        bgcolor = [NSString stringWithFormat:@"#dedede"];
        boarderline = [NSString stringWithFormat:@"#cfcfcf"];
    
    [readmorebtn setTitleColor:[UIColor getUIColorFromHex:TextColor alpha:1.0] forState:UIControlStateNormal];
    logoimg.image = [UIImage imageNamed:logoimage];
    [sharebtn setImage:[UIImage imageNamed:ShareIcon] forState:UIControlStateNormal];
    [nextcartbtn setImage:[UIImage imageNamed:nextcardIcon] forState:UIControlStateNormal];
    placeholderview.backgroundColor = [UIColor getUIColorFromHex:BGColor alpha:1.0];
    placeholderview.layer.borderWidth = 1.0f;
    placeholderview.layer.borderColor = [UIColor getUIColorFromHex:boarderline alpha:1.0].CGColor;
    boarderview.backgroundColor = [UIColor getUIColorFromHex:boarderline alpha:1.0];
    self.contentView.backgroundColor = [UIColor getUIColorFromHex:bgcolor alpha:1.0];


-(IBAction)loadImageView:(NSString *)entryId 
    [downloadButton setImage:nil forState:UIControlStateNormal];
    dispatch_async(dispatch_get_main_queue(), ^
        [imageview sd_setImageWithURL:[NSURL URLWithString:imgStr] placeholderImage:[UIImage imageNamed:[NSString stringWithFormat:@"PlaceholderImage-Day"]] completed:^(UIImage *setImage, NSError *err, SDImageCacheType cachetype, NSURL *url) 
            if (setImage) 
                [imageCache storeImage:setImage forKey:entryId toDisk:YES completion:nil];
            
        ];
    );


- (void)handleTapFrom:(UIButton *)sender 
    if ([Network Check]) 
        NSLog(@"image downloading");
        UIButton *img = (UIButton *) sender;
        [img removeFromSuperview];
        dispatch_async(dispatch_get_main_queue(), ^
            [imageview sd_setImageWithURL:[NSURL URLWithString:imgStr] placeholderImage:[UIImage imageNamed:[NSString stringWithFormat:@"PlaceholderImage-Day"]] completed:^(UIImage *setImage, NSError *err, SDImageCacheType cachetype, NSURL *url) 
                if (setImage) 
                    [imageCache storeImage:setImage forKey:[NSString stringWithFormat:@"%ld",(long)[sender tag]] toDisk:YES completion:nil];
                    NSLog(@"image downloaded");
                
            ];
        );
     else 
        [Network showMessage:[[NSUserDefaults standardUserDefaults] objectForKey:@"nnwDwnldImg"]];
    


- (IBAction)clicked:(id)sender  
    NSString *str = [NSString stringWithFormat:@"%ld",(long)[sender tag]];
    NSLog(@"tagno=%@",str);
    [[NSUserDefaults standardUserDefaults] setObject:str forKey:@"tabedtagNub"];
    if(_delegate) 
        UITableView *parent = (UITableView *)self.superview.superview;
        //UITableView *parent = (UITableView *)[self superview];
        NSIndexPath *indexPath = [parent indexPathForCell:self];
        [_delegate tableView:parent didSelectRowAtIndexPath:indexPath];
    


- (void)layoutSubviews 
    [super layoutSubviews];
    // Make sure the contentView does a layout pass here so that its subviews have their frames set, which we
    // need to use to set the preferredMaxLayoutWidth below.
    [self.contentView setNeedsLayout];
    [self.contentView layoutIfNeeded];
    // Set the preferredMaxLayoutWidth of the mutli-line bodyLabel based on the evaluated width of the label's frame,
    // as this will allow the text to wrap correctly, and as a result allow the label to take on the correct height.
 //   self.titlelab.preferredMaxLayoutWidth = CGRectGetWidth(self.titlelab.frame);
 //    splittext.preferredMaxLayoutWidth = CGRectGetWidth(splittext.frame);


- (void)updateFonts 
    NSNumber *font = [[NSUserDefaults standardUserDefaults] valueForKey:@"fontsize"];
    self.titlelab.font = [UIFont fontWithName:@"Roboto-Regular" size:font.integerValue+2];
    splittext.font = [UIFont fontWithName:@"Roboto-Regular" size:font.integerValue];


@end

HomeCardViewCell Xib

对uitableview和uilabel的动态高度使用自动布局。

从 Crashlytics 获得崩溃报告,在此处添加堆栈跟踪

# OS Version: 9.3.5 (13G36)
# Device: iPod Touch 5G
# RAM Free: 13.8%
# Disk Free: 94.1%

#0. Crashed: com.apple.main-thread
0  CoreText                       0x24f17664 TOpenTypeMorph::SetLookups(OTL::GSUB&, unsigned long const*, OTL::GlyphLookups&) + 131
1  CoreText                       0x24f176f3 TOpenTypeMorph::SetLookups(OTL::GSUB&, unsigned long const*, OTL::GlyphLookups&) + 274
2  CoreText                       0x24f185ad void TOpenTypeMorph::ApplyShapingEngine<TInlineVector<unsigned long, 30ul> >(OTL::GSUB&, OTL::GlyphLookups&, unsigned long*, CFRange, TInlineVector<unsigned long, 30ul>&, bool&, SyncState&) + 508
3  CoreText                       0x24f17871 TOpenTypeMorph::ShapeGlyphs(SyncState&) + 300
4  CoreText                       0x24edc077 TShapingEngine::ShapeGlyphs(TLine&, TCharStream const*) + 214
5  CoreText                       0x24edd80d TTypesetter::FinishEncoding(std::__1::tuple<TLine const*, TCharStream const*, void const* (*)(__CTRun const*, __CFString const*, void*), void*, std::__1::shared_ptr<TBidiLevelsProvider>*, unsigned int, unsigned char> const&, TLine&, signed char) + 160
6  CoreText                       0x24eae707 TTypesetterAttrString::Initialize(__CFAttributedString const*) + 406
7  CoreText                       0x24eae4e3 TTypesetterAttrString::TTypesetterAttrString(__CFAttributedString const*) + 102
8  CoreText                       0x24eae359 CTLineCreateWithAttributedString + 56
9  UIFoundation                   0x271a2b57 __NSStringDrawingEngine + 12742
10 UIFoundation                   0x2719f97d -[NSString(NSExtendedStringDrawing) boundingRectWithSize:options:attributes:context:] + 132
11 UIKit                          0x2722dcab -[UILabel _textRectForBounds:limitedToNumberOfLines:includingShadow:] + 794
12 UIKit                          0x2722d981 -[UILabel textRectForBounds:limitedToNumberOfLines:] + 56
13 UIKit                          0x2722d8a7 -[UILabel _intrinsicSizeWithinSize:] + 134
14 UIKit                          0x2732ab43 -[UILabel intrinsicContentSize] + 82
15 UIKit                          0x2732a963 -[UIView(UIConstraintBasedLayout) _generateContentSizeConstraints] + 30
16 UIKit                          0x2732a3f3 -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 574
17 UIKit                          0x273269c7 -[UIView(AdditionalLayoutSupport) updateConstraints] + 238
18 UIKit                          0x2732a1ad -[UILabel updateConstraints] + 304
19 UIKit                          0x27a659df -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 462
20 UIKit                          0x27a65c59 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 168
21 UIKit                          0x27a658f5 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 228
22 Foundation                     0x2343ddf9 -[NSISEngine withBehaviors:performModifications:] + 256
23 UIKit                          0x2732937d -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 52
24 UIKit                          0x27a65c35 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPassAndViewsNeedingBaselineUpdate:forSecondPass:] + 132
25 Foundation                     0x2343ddf9 -[NSISEngine withBehaviors:performModifications:] + 256
26 UIKit                          0x2732937d -[UIView(AdditionalLayoutSupport) _withAutomaticEngineOptimizationDisabledIfEngineExists:] + 52
27 UIKit                          0x27329ecb -[UIView(AdditionalLayoutSupport) updateConstraintsIfNeeded] + 582
28 UIKit                          0x278415e7 -[UITableViewCellContentView updateConstraintsIfNeeded] + 182
29 UIKit                          0x27a63733 -[UIView(AdditionalLayoutSupport) _systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:hasIntentionallyCollapsedHeight:] + 382
30 UIKit                          0x276a8edf -[UITableViewCell systemLayoutSizeFittingSize:withHorizontalFittingPriority:verticalFittingPriority:] + 438
31 UIKit                          0x2756ce5b -[UITableView _heightForCell:atIndexPath:] + 442
32 UIKit                          0x2736e743 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 3186
33 UIKit                          0x27231541 +[UIView(Animation) performWithoutAnimation:] + 72
34 UIKit                          0x2736dac3 -[UITableView _configureCellForDisplay:forIndexPath:] + 458
35 UIKit                          0x275694cd -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 776
36 UIKit                          0x275695a5 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 68
37 UIKit                          0x27558b51 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2272
38 UIKit                          0x2756dd1b -[UITableView _performWithCachedTraitCollection:] + 78
39 UIKit                          0x2730d23b -[UITableView layoutSubviews] + 178
40 UIKit                          0x2721ea73 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 714
41 QuartzCore                     0x252b6bcd -[CALayer layoutSublayers] + 128
42 QuartzCore                     0x252b2375 CA::Layer::layout_if_needed(CA::Transaction*) + 348
43 QuartzCore                     0x252b2209 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
44 QuartzCore                     0x252b16d1 CA::Context::commit_transaction(CA::Transaction*) + 368
45 QuartzCore                     0x252b13a5 CA::Transaction::commit() + 520
46 QuartzCore                     0x253038ff CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 762
47 IOMobileFramebuffer            0x249ea50b IOMobileFramebufferVsyncNotifyFunc + 86
48 IOKit                          0x22ef8759 IODispatchCalloutFromCFMessage + 256
49 CoreFoundation                 0x22c5637d __CFMachPortPerform + 132
50 CoreFoundation                 0x22c6a5b3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
51 CoreFoundation                 0x22c69cc7 __CFRunLoopDoSource1 + 342
52 CoreFoundation                 0x22c680d9 __CFRunLoopRun + 1688
53 CoreFoundation                 0x22bb7229 CFRunLoopRunSpecific + 520
54 CoreFoundation                 0x22bb7015 CFRunLoopRunInMode + 108
55 GraphicsServices               0x241a7ac9 GSEventRunModal + 160
56 UIKit                          0x2728b189 UIApplicationMain + 144
57 60SecondsNow                   0x127799 main (main.m:15)
58 libdispatch.dylib              0x2285f873 (Missing)

通过这个崩溃报告,我猜这可能是泰卢固语语言脚本的 coretext 库中的问题,请帮助我。

【问题讨论】:

【参考方案1】:

我在 Bug Reporter 中针对上述崩溃问题打开了一个 Bug,特别是针对 Telugu Script。

得到了 Apple 的回复,如下所示

"" 苹果开发者关系

工程部门提供了有关此问题的以下信息:

这在 CoreText 中崩溃了。但是,如果此问题在 iOS 10 中得到解决,我们将无法对 iOS 9 进行更新。请验证并确保其在 iOS 11 上运行。

iOS 11 测试版 7 (15A5362a) https://developer.apple.com/download/

如果问题仍然存在,请附上在最新版本中捕获的新 sysdiagnose 并将其附加到错误报告中。

iOS 系统诊断说明: https://developer.apple.com/services-account/download?path=/iOS/iOS_Logs/sysdiagnose_Logging_Instructions.pdf


有关日志记录指令的完整列表,请访问: https://developer.apple.com/bug-reporting/profiles-and-logs/""

【讨论】:

以上是关于滚动 UITableview 时发生崩溃的主要内容,如果未能解决你的问题,请参考以下文章

UITableView 在快速滚动时崩溃

滚动时 UITableView 崩溃

UITableView 在滚动时崩溃

编辑第一个 UITextField 时,如何将 UITableView 滚动到第二个 UITextField?

iOS:滚动 UITableView 时应用程序崩溃/内存被填充

快速滚动时带有 AlamofireImage 的 Swift UItableview 崩溃