美文网首页错误集锦iOS程序猿bugs
xcode 删除工程中的warning

xcode 删除工程中的warning

作者: zaijianbali | 来源:发表于2017-06-05 16:29 被阅读65次

    1.项目中出现了如下警告

    警告

    具体代码如下

    self.navigationController.navigationBar.titleTextAttributes = 
    [NSDictionary dictionaryWithObjectsAndKeys:BIMRGBA(51, 51, 51, 1), UITextAttributeTextColor,
     [UIFont systemFontOfSize:19], UITextAttributeFont,
     [UIColor clearColor], UITextAttributeTextShadowColor, nil];
    

    具体如下:

    'UITextAttributeFont' is deprecated: first deprecated in iOS 7.0 - Use NSFontAttributeName

    'UITextAttributeTextColor' is deprecated: first deprecated in iOS 7.0 - Use NSForegroundColorAttributeName

    'UITextAttributeTextShadowColor' is deprecated: first deprecated in iOS 7.0 - Use NSShadowAttributeName with an NSShadow instance as the value
    这个一般一起出现。
    修改如下,注意下NSShadow 的位置,不能直接用[UIColor clearColor] ,必须使用NSShadow 对象,否则crash。

    正确代码如下:

      NSShadow *shadow = [[NSShadow alloc] init];
        shadow.shadowColor = [UIColor clearColor];
        shadow.shadowOffset = CGSizeMake(1,0);
        self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:BIMRGBA(51, 51, 51, 1), NSForegroundColorAttributeName,
         [UIFont systemFontOfSize:19], NSFontAttributeName, 
         shadow, NSShadowAttributeName, nil];
    

    2.关于warning: no rule to process file的问题

    warning: no rule to process file '/Users/xx/ThirdParty/SDK-ThirdParty/TTTAttributedLabel/README.md' of type net.daringfireball.markdown for architecture i386
    warning: no rule to process file '/Users/xx/ThirdParty/SDK-ThirdParty/TTTAttributedLabel/README.md' of type net.daringfireball.markdown for architecture x86_64

    解决的方法很简单:在【build phases】—>【compile sources】 里面将对应的文件移除即可。

    删除编译文件

    本文解释权归:子文

    如需转载请注明出处,谢谢

    来杯可乐催更吧

    请子文喝可乐

    相关文章

      网友评论

        本文标题:xcode 删除工程中的warning

        本文链接:https://www.haomeiwen.com/subject/vjoifxtx.html