iOS 开发随笔(不定期更新)

请求网络一定要验证返回值的合法性
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

出现这个原因是 ,因为项目使用了Cocopods,项目是用低版本的Swfit 开发,在Xcode 升级后继续开发,这时导入新 的库是依赖高版本的Swift。Cocopods 引入的库都会有一个Swift版本。

post_installdo|installer|
  installer.pods_project.targets.eachdo|target|
    target.build_configurations.eachdo|config|
      config.build_settings['SWIFT_VERSION'] ='4.0'
    end
  end
  end
// 这就话的意思限定每个Pod都是在4.0下编译

Modal 出一个半透明的VC

UIViewController *vc = [UIViewControlller alloc] init];
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;   
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
vc.view.backgroundColor = [UIColor clearColor];

信号锁

@interface Foo ()
  @property (strong, nonatomic) dispatch_semaphore_t lockSemaphore;
@end 
@implementation
   
- (instancetype)init
{
    if (self = [super init]) {
            //这里一定是1
           _lockSemaphore = dispatch_semaphore_create(1);
    } 
     return self;
}
- (void)lock
{
    dispatch_semaphore_wait(_lockSemaphore, DISPATCH_TIME_FOREVER);
}

- (void)unlock
{
    dispatch_semaphore_signal(_lockSemaphore);
}
end
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 休假前,我一直想着有6个月长假,不知道如何度过,同时也励志要学这个学那个。但是有孩子后,时间基本被占用。并没有自己...
    轻舞飞扬_5e1f阅读 242评论 0 0
  • 本期菜小白带来了一个新图表,虽然不常见,但是其实超实用,它叫竖型折线图,也叫蛇形图。在这个图表中,展示了消费者对某...
    菜小白学数据分析阅读 10,932评论 0 2
  • 记忆仿佛停留在2016.5.24日,那是我和她最后一次见面。 幸,你现在过得幸福吗?记得一年半前我和她还有微信联系...
    心若安一切安好阅读 136评论 0 0
  • 可怜街边小贩商 一天守侯三五人 人机争霸机为王 昔人行人被机绑
    陈糊涂阅读 197评论 0 0
  • 2018年12月23日 星期一 晴 多给自己一些掌声,有勇气做你自己。 要懂得爱自己,健康让你的人...
    宋音缘阅读 184评论 0 0