【Swift】开发笔记(一)

image.png
  • 1.iOS15使用UINavigationBarAppearance后Snapkit布局上移
    使用topMargin代替top
logo.snp.makeConstraints { (make) in
        make.centerX.equalToSuperview()
        make.top.equalTo(view.snp.topMargin).offset(80)
        make.size.equalTo(CGSize.init(width: 72, height: 72))
 }
    1. Reason: image not found
      dyld: Library not loaded: @rpath/FrameworkOC.framework/FrameworkOC
      Referenced from: /Users/fangyangdebeiduofen/Library/Developer/CoreSimulator/Devices/A94C1F38-5973-4B79-8338-45A9B0D9ADB4/data/Containers/Bundle/Application/B1AF023B-41CC-4745-BC02-E252BDB02049/FrameworkTestDemo.app/FrameworkTestDemo


      截屏2022-01-19 上午11.12.50.png

      动态库需要将Dot not embed修改为Embed & Sign

  • 3.视频通过到微信到电脑上,存在发送立体音变成单声道,踩个坑

  • 4.cellForItemAtIndexPath 如果是不可见cell会返回空
    可以先滚动后调用

[self.table scrollToItemAtIndexPath:indexPath
                                        atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally
                                                animated:NO];
 [self.table layoutIfNeeded];
 cell = [self.table cellForItemAtIndexPath:indexPath];
  • 5.新建.gitignore网站
  • 6.苹果开发者论坛
  • 7.Unable to load contents of file list: input/output xcfilelist
    应该是装了俩个pod,平时install时候混乱导致
    解决方式:
delete 'Pods/', 'Podfile.lock', 'yourappname.xcworkspace'
pod deintegrate
pod install
  • 8 pod search xxx出现Unable to find a pod with name, author, summary, or description matching
    解决方案
$ rm ~/Library/Caches/CocoaPods/search_index.json 
$ pod search xxx

有的时候创建第二天就会出现,神奇~

  • 9 Failed to connect to github.com port 443: Operation timed out
    更新某个pod的库时候遇到
    解决办法:
    在https://www.ipaddress.com/上搜索github.com的IP
    然后执行
sudo vi /etc/hosts 

新增或修改

140.82.114.3  github.com
  • 10 单例遇到的一些问题


    image.png

在单例的初始化中继续通过shared的调用会因为内存问题导致崩溃,这个例子比较简单,如果在项目中可能需要深入挖掘,平时要注意

  • 11.NSBundle.h报错
    需要重新配置版本 Xcode -> Preferences -> Location -> Command Line Tools

  • 12.scrollToItem
    scrollToItem之前要判空且大于0

你可能感兴趣的:(【Swift】开发笔记(一))