Xcode8解决中文乱码的问题及各种零碎问题





Xcode8解决中文乱码,也可以用pjson

很简单,直接贴代码了,拷贝进工程,就OK。

#import <Foundation/Foundation.h>

@interface Foundation_Log : NSObject

@end

@interface NSArray (Log)

@end

@interface NSDictionary (Log)

@end


#import "Foundation+Log.h"

@implementation Foundation_Log

@end

@implementation NSArray (Log)

- (NSString *)descriptionWithLocale:(id)locale
{
    NSMutableString *strM = [NSMutableString stringWithString:@"(\n"];
    
    [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        [strM appendFormat:@"\t%@,\n", obj];
    }];
    
    [strM appendString:@")"];
    
    return strM;
}

@end

@implementation NSDictionary (Log)

- (NSString *)descriptionWithLocale:(id)locale
{
    NSMutableString *strM = [NSMutableString stringWithString:@"{\n"];
    
    [self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
        [strM appendFormat:@"\t%@ = %@;\n", key, obj];
    }];
    
    [strM appendString:@"}\n"];
    
    return strM;
}

@end



安装chisel(推荐)

命令行输入以下命令

 brew update
 brew install chisel
 touch ~/.lldbinit
 command script import /usr/local/opt/chisel/libexec/fblldb.py
 command source ~/.lldbinit

 

 真是是太好了,再也不用在lldbunicode编码的json中文数据了。哈哈。。

 chisel不只是pjsonNB,它的其它的命令也很NB,很好用,比如

 pviews(打印控件的信息)、

 border(查看控件的边框,可以不用重写代码设置颜色等)、

 pclass(查看类的层级关系)。我还没研究很多,等有时间研究了,再分享出来。

 

 总之,chisel挺好用的,对lldb调试效率确实调高了不少。





删除烦人的红色文字警告,黄色文件警告

 Xcode -> Preferences -> Source Control -> Enable Source Control
 Command +alt +shift + K
 cd "project directory"
 git add .
瞬间,从999+ 回到98+ 警告,太舒坦了


常见编译警告

-Wincompatible-pointer-types    指针类型不匹配
-Wincomplete-implementation     没有实现已声明的方法
-Wprotocol                      没有实现协议的方法
-Wimplicit-function-declaration 尚未声明的函数(通常指c函数)
-Warc-performSelector-leaks     使用performSelector可能会出现泄漏
-Wdeprecated-declarations       使用了不推荐使用的方法(如[UILabel setFont:(UIFont*)])
-Wunused-variable               含有没有被使用的变量
-Wundeclared-selector           未定义selector方法



other warning Flags 去掉其余警告

-Wno-shorten-64-to-32

-Wno-unreachable-code

目前我只写了这两样,比较烦人的,不会的问Google

屏蔽项目指定文件指定类型警告:-Wno-unused-variable

屏蔽工程指定类型警告:  -Wno-unused-variable


NSInteger 与 int 警告

1、系统推荐方法               [NSString stringWithFormat:@“%ld", (long)number];
 2、类型强制                  [NSString stringWithFormat:@"%d", (int)number];
 3、使用NSNumber类型          [NSString stringWithFormat:@“%@", @(number)];
 4、对应数字是一个size_t的值    [NSString stringWithFormat:@“%zd",number];



屏蔽Pods警告

在podfile文件中增加一句inhibit_all_warnings! 来屏蔽pod的工程的任何警告。

# platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
inhibit_all_warnings!
target 'RuntimeLearn' do
pod 'UITextView+Placeholder', '~> 1.1.1'
pod 'MJRefresh', '~> 3.1.0'
#也可以单独设置打开编译警告就好了
pod 'Alamofire', '~> 3.0.0-beta.3', :inhibit_warnings => true
end









如果你的博客访问量很大,你可以通过如下方式在博客上放置广告而通过博客赚钱,这篇文章教你怎么在你的博客上放置广告代码:

 

首先你需要申请Adsense帐号,到 https://www.google.com/adsense 注册。如果以前注册过Google AdWords(Google广告词——对关键字进行右侧付费推广)那么就能使用您的Google AdWords密码登录,开通Google AdSense了。

申请完Adsense帐号后即可获取广告代码:Adsense设置->获取广告,设置完后会获得广告代码。

你可以通过两种方式来将Google广告添加进CSDN Blog中,一种是添加进公告中,另一种则是添加到你发布的文章中。

第一种方式直接在博客的后台管理->配置->公告中添加进Adsense代码即可,效果参看我的博客左侧,大家一定注意广告的格式,不要太宽,否则会改变网页的外观。

第二种就是添加进你发布的文章中,首先在你写好的文章中点击“HTML源代码”注意CSDN中写文章的高级模式中才有这项,然后将Adsense代码添加进合适的位置,像我的广告代码是在右侧,则代码是:

<div style="float: right; margin-left: 2px">
<script type="text/JavaScript"><!--
google_ad_client = "pub-2616259956670917";
/* CSDN博客文章(加广告代码)右侧 */
google_ad_slot = "7943476622";
google_ad_width = 200;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

</div>

 



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值