警告错误整理(3)

作者: 石丘 | 来源:发表于2015-06-02 20:47 被阅读1744次

    一、隐藏自定义的tabbar 死活隐藏不了  

    后来找朋友问了下 发现 我用的实例没初始化 WTF!!!

    于是余有叹焉   查bug 先打断点看内存  

    二、在一个视图里面用bringSubviewToFront 没效果

    应该在同一个父视图添加完其它视图后 调用[self.view bringSubviewToFront:pickview];

    三、Implicit conversion loses integer precision: 'NSUInteger' (aka 'unsigned long') to 'int'

    implicit [ɪm'plɪsɪt]adj. 含蓄的;暗示的;盲从的  隐式( Implicit ) :对于给定变量,单元内的未知值用邻近单元的已知和未知值计算得出。

    conversion [kən'və:ʃən]n. 转换;变换;[金融] 兑换;改变信仰

    loses ['lu:zɪz]损失  integer ['ɪntɪdʒə]n. [数] 整数;整体;完整的事物

    precision [pri'siʒən] n. 精度,[数] 精密度;精确

    aka  ['ækə]. 又叫做,亦称(also known as)

    隐式转换损失精度整数:“NSUInteger”(又名“无符号长”)“int”

    可以在前面添加个括号 强转下 (int)  也可以转成 nsnumer  intvalue

    四、*** Terminating app due to uncaught exception 'RLMException', reason: 'Index is out of bounds.'

    由于捕获到异常RLMException 导致索引越界

    terminate ['tɜːmɪneɪt]vt. 使终止;使结束;解雇 vi. 结束,终止;结果 adj. 结束的

    terminating [/'tə:mineitiŋ]n. [电] 终接 v. 结束;使终结;解雇(terminate的现在分词)

    due to 由于因为      uncaught 捕获       exceptionn. 例外;异议

    *** First throw call stack:

    libc++abi.dylib: terminating with uncaught exception of type NSException

    五、关于隐藏电池条

    本来是通过下面这个方法隐藏的电池条

    - (BOOL)prefersStatusBarHidden{

    return YES;

    }

    后来改动了 plist里面的 View controller-based status bar appearance项

    设为了YES, 结果我上面那个方法就不走了 

    在代码里添加了[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO]; 就ok了 

    补两个tips

    取info.plist中 View controller-based status bar appearance中的设置:

    NSNumber *isVCBasedStatusBarAppearanceNum = [[NSBundle mainBundle]objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"];

    if (isVCBasedStatusBarAppearanceNum){

    _isVCBasedStatusBarAppearance = isVCBasedStatusBarAppearanceNum.boolValue;

    }  else {

    _isVCBasedStatusBarAppearance = YES; // default

    }

    在view controller中调用setNeedsStatusBarAppearanceUpdate,更新status bar的显示。

    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {

    [self prefersStatusBarHidden];

    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];

    六:Info.plist与Prefix.pch路径错误(转)

    如果要更改Info.plist与Prefix.pch文件实际路径,也就是实际文件的位置(不是在工程中的组织路径),需要到Build Settings中修改对应的配置,不然工程就找不到对应的Info.plist与Prefix.pch文件。

    报错情况:

    1、Info.plist文件路径错误

    error: could not read data from '/Users/sf_gxd/Desktop/Gasake/Gasake/Gasake-Info.plist': The file “Gasake-Info.plist” couldn’t be opened because there is no such file.

    2、prefix.pch文件路径错误

    clang: error: no such file or directory: '/Users/sf_gxd/Desktop/Gasake/Gasake/Gasake-Prefix.pch'

    clang: error: no input files

    prefix.pch Info.plist

    如果还是报错就是没修改test里面的地址

    Prefix.pch的路径尽量用相对路径$(SRCROOT) 不然路径一有改动就要跑回去改

    七.Xcode6以后 添加Prefix.pch文件的问题

    (系统不生成了 尽量不用的好)用的话 在other里面新建 然后到build Setting里面 搜Prefix 是 Prefix 而不是pch因为这个时候里面有没有 pch文件的 然后把地址拖进去就可以了

    八.unrecognized selector sent to instance 0x7fbdb05dbeb0'

    ddbutton

    button的监听事件添加习惯了 直接@selector了  在这个地方应该是 把action 放进去

    不同情况不同对待 习惯亦可误人

    九.关于button 选中状态下的TintColor颜色

    [camerabtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];

    [camerabtn setTitleColor:[UIColor blueColor] forState:UIControlStateSelected];

    左边那个是选中状态 后面那个蓝色背景 是7以后的tintcolor造成的

    所以在上述代码后还要再添加一句[camerabtn setTintColor:[UIColor clearColor]];

    去除tint颜色

    十.迷之button 

    今天搞的button无法点击 最后发现是是由于位置偏离了父视图的原因,搜狗输入法又作死了 

    相关文章

      网友评论

        本文标题:警告错误整理(3)

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