Xcode 6.3(和6.2)在[UIFont fontWithName:size:]上遇到断点 [英] Xcode 6.3 (and 6.2) hits breakpoint on [UIFont fontWithName: size:]

查看:94
本文介绍了Xcode 6.3(和6.2)在[UIFont fontWithName:size:]上遇到断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iOS应用程序中使用类(DKTheme)将我的字体和图像保存在一个集中的位置。我的实现看起来像这样。

In My iOS Application im using a class (DKTheme) to keep my fonts and images in a centralised place. my implementation looks like this.

+ (instancetype)theme {
    static DKTheme *_theme = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _theme = [[DKTheme alloc] init];
    });
    return _theme;
}

- (id)init {
    self = [super init];
    if (self) {
        [self setupTheme];
    }
    return self;
}

- (void)setupTheme {
// some code here
self.smallButtonFont = [UIFont fontWithName:@"Helvetica-Bold" size:13.0f];
//some code here
}

当我运行此代码时设备(iPhone 5C,iOS8.3和iOS8.2),xcode命中行上的断点 self.smallButtonFont = [UIFont fontWithName:@Helvetica-Bold大小:13.0f]; 如果我点击继续执行按钮,应用程序继续运行而不会崩溃,我的字体属性( self.smallButtonFont )已成功初始化。

And when i run this code in device (iPhone 5C, iOS8.3 and iOS8.2), xcode hits breakpoint on the line self.smallButtonFont = [UIFont fontWithName:@"Helvetica-Bold" size:13.0f]; if i click continue execution button, application continue running without crashing and my font property(self.smallButtonFont) is successfully initialised.

我注意到还有一件事,我有几个 [UIFont fontWithName:size:]; 只有第一次调用时才会调用和断点命中。(如果我对第一个进行注释,则下一个方法调用会触及断点)。这真的很烦人这个断点问题,任何帮助都会很感激。

and i noticed one more thing, i have several [UIFont fontWithName: size:]; calls and breakpoint hits only first time call.(if i comment the first one then next method call hits the break point). it is really annoying this breakpoint issue, any help would be thankful.

推荐答案

你在Xcode中添加了断点异常并对其进行了配置打破所有异常类型,C ++和Objective-C。问题是C ++代码有时会在非特殊情况下使用异常。它可能只是作为一种流控制形式或从函数返回失败。

You have added a breakpoint exception in Xcode and configured it to break on all exception types, C++ and Objective-C. The problem is that C++ code sometimes uses exceptions for non-exceptional situations. It may use it just as a form of flow control or returning "failure" from a function.

除非你有一个特定的C ++异常需要调试,因为它实际上是导致问题,可能最好将该断点配置为仅打破Objective-C异常而不是C ++异常。可以安全地忽略C ++异常。

Unless you have a specific C++ exception that you need to debug because it's actually causing a problem, probably best to configure that breakpoint to just break on Objective-C exceptions and not C++ exceptions. The C++ exceptions can be safely ignored.

这篇关于Xcode 6.3(和6.2)在[UIFont fontWithName:size:]上遇到断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆