美文网首页
iOS 开发随笔(不定期更新)

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

作者: 米修斯_ | 来源:发表于2019-08-07 10:40 被阅读0次
请求网络一定要验证返回值的合法性
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

相关文章

网友评论

      本文标题:iOS 开发随笔(不定期更新)

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