开发日记

1,168 阅读3分钟

2020年7月22日

今天使用InjectionIII的时候一直Crash,从堆栈上看不出什么原因

[4387:68391] *** -[RACDynamicSignal retain]: message sent to deallocated instance 0x60000218b240

用脚趾头想一下肯定又是刷新的时候重复使用了RAC,但是定位不到,只能请出万能的百度,解决方案如下:

1、给Xcode添加两个环境变量

NSZombieEnabled = YES
MallocStackLogging = YES

有啥用咱也不敢问,然后再次运行模拟器,没有意外的又挂了,下面就要使用两个关键信息了

[4387:68391] *** -[RACDynamicSignal retain]: message sent to deallocated instance 0x60000218b240

进程ID:4387

内存地址:0x60000218b240

然后打开万能的iTerm,输入下面的命令

sudo malloc_history 4387 0x60000218b240

崩溃堆栈如下:

Invalid connection: com.apple.coresymbolicationd
malloc_history Report Version:  2.0
ALLOC 0x60000218b240-0x60000218b25f [size=32]:  0x1127cc10d (libdyld.dylib) start | 0x105beed80 (com.yeedi.app) main  main.m:14 | 0x11c347220 (com.apple.UIKitCore) UIApplicationMain | 0x113d53c1a (com.apple.GraphicsServices) GSEventRunModal | 0x10a996884 (com.apple.CoreFoundation) CFRunLoopRunSpecific | 0x10a99706a (com.apple.CoreFoundation) __CFRunLoopRun | 0x10a996b1e (com.apple.CoreFoundation) __CFRunLoopDoObservers | 0x10a99c067 (com.apple.CoreFoundation) __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ | 0x10d6a3d81 (com.apple.QuartzCore) CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) | 0x10d6a33ef (com.apple.QuartzCore) CA::Transaction::commit() | 0x10d66fa14 (com.apple.QuartzCore) CA::Context::commit_transaction(CA::Transaction*, double) | 0x10d7269a2 (com.apple.QuartzCore) CA::Layer::layout_and_display_if_needed(CA::Transaction*) | 0x10d71b30b (com.apple.QuartzCore) CA::Layer::layout_if_needed(CA::Transaction*) | 0x10d715180 (com.apple.QuartzCore) -[CALayer layoutSublayers] | 0x11c848ae8 (com.apple.UIKitCore) -[UIView(CALayerDelegate) layoutSublayersOfLayer:] | 0x11baff4ce (com.apple.UIKitCore) -[UICollectionView layoutSubviews] | 0x11bafa37f (com.apple.UIKitCore) -[UICollectionView _updateVisibleCellsNow:] | 0x11baf4adf (com.apple.UIKitCore) -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] | 0x11baf4c85 (com.apple.UIKitCore) -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] | 0x105c08e3e (com.yeedi.app) -[DeviceListCollectionView collectionView:cellForItemAtIndexPath:]  DeviceListCollectionView.m:155 | 0x11bb0a7ed (com.apple.UIKitCore) -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] | 0x11bb0a20c (com.apple.UIKitCore) -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] | 0x105bf9792 (com.yeedi.app) -[DeviceListCell initWithFrame:]  DeviceListCell.m:141 | 0x105bed7ef (com.yeedi.app) -[EmptyCell buildUI]  EmptyCell.m:22 | 0x10633b30e (com.yeedi.app) -[UIGestureRecognizer(RACSignalSupport) rac_gestureSignal]  UIGestureRecognizer+RACSignalSupport.m:23 | 0x10631f256 (com.yeedi.app) +[RACSignal createSignal:]  RACSignal.m:31 | 0x1062ef9c4 (com.yeedi.app) +[RACDynamicSignal createSignal:]  RACDynamicSignal.m:29 | 0x10f3cd0c6 (libobjc.A.dylib) _objc_rootAllocWithZone | 0x112a49ad8 (libsystem_malloc.dylib) calloc | 0x112a49426 (libsystem_malloc.dylib) malloc_zone_calloc

找到你了~ DeviceListCollectionView.m:155

2020年7月27日

今天记几个东西:

1、Allow Non-modular includes in Framework Modules

之前写代码都是使用这种方法直接导的#import "Masonry.h" ,但是如果把代码静态化以后,就必须使用这种方式#import <Masonry/Masonry.h>,如果改的地方多了,那必须的崩溃了,在Build Setting里直接把这个开关打开,就可以解决问题

2、Podfile设置

install! 'cocoapods', :generate_multiple_pod_projects => true

加上这么一行,Pods库就会以project的方式引入,听说可以加快索引速度,不知道真假

#解决静态库报错
pre_install do |installer|Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}end

这一行是为了解决使用了静态库,又想使用use_frameworks!方式导入库的

2020年8月3日

使用AppCode的时候,想安装一个主题插件,奈何网络太慢了,所以自己离线下载了一份,下载也很慢,这里存一份wwe.lanzous.com/i9QZif91nng 下载下来解压,然后把material-theme-jetbrains-5.3.2.1.jar直接拖到AppCode里就行了,我用的AppCode版本是2020.1.3

2020年9月16日

最近用Swift写项目,用到了RxSwift的库,但是使用CocoaPods管理的时候一直会报错

Missing required module 'RxCocoaRuntime'

但是使用SPM管理的时候就一切正常,但这终究不是解决之道,终于在一个博客里找到了解决方案

blog.indigo.codes/2018/03/08/…

主要就是把RxCocoaRuntime这个库单独处理下(为了方止大佬删除,所以我先fork为敬)

pod 'RxCocoaRuntime', :podspec => 'https://raw.githubusercontent.com/ZWXAllen/UseStaticFramework/master/RxCocoaRuntime.podspec'

2020年9月18

更新了xcode 12,但是在使用Cocoapods更新的时候报错了


Cloning into '/var/folders/4n/7hpg08m910zb9qvbzv4kd7100000gn/T/d20200918-6082-ng9j0d'...
fatal: Unsupported SSL backend '“openssl”'. Supported SSL backends:
	secure-transport
	openssl

昨天还好好的,也不知道是什么问题。百度后找到解决方案

$git config --global http.sslVerify false

$git config --global http.sslBackend "openssl"