美文网首页
iOS | 技术点小记4

iOS | 技术点小记4

作者: 清無 | 来源:发表于2021-04-28 16:36 被阅读0次

Windows端口占用

  • netstat -aon|findstr "8085"
  • tasklist|findstr "14572"
  • task >taskkill /T /F /PID the port pid number

端口占用

  • sudo lsof -i:(port)
  • sudo kill (PID)

Swift tool-chain下载

https://www.swift.org/download

Xcode 版本下载

https://download.developer.apple.com/Developer_Tools/Xcode_12.5.1/Xcode_12.5.1.xip

xcodebuild 使用系统git终端代理解决github慢问题

xcodebuild -resolvePackageDependencies -scmProvider system

PublicAIPs

https://github.com/public-apis/public-apis

iOS15导航栏适配

if (@available(iOS 15.0, *)) {
        UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
        appearance.titleTextAttributes = @{NSForegroundColorAttributeName :UIColor.greenColor};
        appearance.backgroundColor = UIColor.redColor;
        
        appearance.buttonAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName: UIColor.greenColor};
        appearance.doneButtonAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName: UIColor.greenColor};
        appearance.backButtonAppearance.normal.titleTextAttributes = @{NSForegroundColorAttributeName: UIColor.yellowColor};
        
        self.navigationBar.scrollEdgeAppearance = appearance;
        self.navigationBar.standardAppearance = appearance;
    }

Xcode低版本调试真机高版本

  • 复制高版本Xcode对应的iPhoneOS15.0.sdk到低版本Xcode的目录/Applications/Xcode12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
  • 复制15.0对应的文件到低版本Xcode目录/Applications/Xcode12.5.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

Docker

https://kapeli.com/dash

免费icons

https://icons8.com

Font Bold Text

UIFontWeightUltraLight > UIFontWeightThin
UIFontWeightThin > UIFontWeightLight
UIFontWeightLight > UIFontWeightRegular
UIFontWeightRegular > UIFontWeightSemibold 
UIFontWeightMedium > UIFontWeightBold
UIFontWeightSemibold > UIFontWeightHeavy
UIFontWeightBold > UIFontWeightBlack
UIFontWeightHeavy > UIFontWeightBlack
UIFontWeightBlack > UIFontWeightBlack

免费工具网站

https://juejin.cn/post/7010397195157372942

网易云音乐API

https://neteasecloudmusicapi.vercel.app

PicGo + Gitee 配置图床

PlanUML

https://plantuml.com/zh

免费图片api

https://picsum.photos

Swift 规范

https://juejin.cn/post/7017740209236213791

国内网速测试

http://www.17ce.com/site

UserDefaults 下标

// UserDefaults.standard[key] = value

extension UserDefaults {
    subscript(key: String) -> Any? {
        set{
            setValue(newValue, forKey: key)
            synchronize()
        }
        get{
            return value(forKey: key)
        }
    }
}

汉字笔画库

HanZiWriterhttps://hanziwriter.org/docs.html

Jasper 入门

https://blog.csdn.net/dullchap/article/details/51799070

深入iOS系统底层之crash解决方法

https://juejin.cn/post/6844903670404874254

iOS设备升/降级

https://www.163.com/dy/article/GDVG8MBH05373GLF.html

大陆身份证号计算规则

计算方法
1、将前面的身份证号码17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2。
2、将这17位数字和系数相乘的结果相加。
3、用加出来和除以11,看余数是多少?
4、余数只可能有0-1-2-3-4-5-6-7-8-9-10这11个数字。其分别对应的最后一位身份证的号码为1-0-X -9-8-7-6-5-4-3-2。(即余数0对应1,余数1对应0,余数2对应X...)
5、通过上面得知如果余数是3,就会在身份证的第18位数字上出现的是9。如果对应的数字是2,身份证的最后一位号码就是罗马数字X。
例如:某男性的身份证号码为【53010219200508011X】, 我们看看这个身份证是不是符合计算规则的身份证。
首先我们得出前17位的乘积和【(5*7)+(3*9)+(0*10)+(1*5)+(0*8)+(2*4)+(1*2)+(9*1)+(2*6)+(0*3)+(0*7)+(5*9)+(0*10)+(8*5)+(0*8)+(1*4)+(1*2)】是189,然后用189除以11得出的结果是189÷11=17余下2,187÷11=17,还剩下2不能被除尽,也就是说其余数是2。最后通过对应规则就可以知道余数2对应的检验码是X。所以,可以判定这是一个正确的身份证号码。

Xcode已损坏,无法打开,您应该将其移至废纸篓

xattr -rc /Applications/Xcode.app

递归获取满足条件subview

extension UIView {
    func subviews(where condition: (UIView) throws -> Bool) rethrows -> [UIView] {
        var subs = try subviews.filter(condition)
        for sub in subviews {
            let matches = try sub.subviews(where: condition)
            subs.append(contentsOf: matches)
        }
        return subs
    }
}

16进制颜色转换


    static func _hexColor(_ hexString: String) -> UIColor? {
        var string = ""
        if hexString.lowercased().hasPrefix("0x") {
            string =  hexString.replacingOccurrences(of: "0x", with: "")
        } else if hexString.hasPrefix("#") {
            string = hexString.replacingOccurrences(of: "#", with: "")
        } else {
            string = hexString
        }

        if string.count == 3 { // convert hex to 6 digit format if in short format
            var str = ""
            string.forEach { str.append(String(repeating: String($0), count: 2)) }
            string = str
        }

        guard let hexValue = Int(string, radix: 16) else { return nil }

        let red = (hexValue >> 16) & 0xff
        let green = (hexValue >> 8) & 0xff
        let blue = hexValue & 0xff
        return .init(red: CGFloat(red)/255, green: CGFloat(green)/255, blue: CGFloat(blue)/255, alpha: 1)
    }

百度地图SDK

https://lbsyun.baidu.com/index.php?title=iossdk/guide/

高德地图SDK

https://lbs.amap.com/api/ios-sdk/guide/
唤起:https://lbs.amap.com/api/amap-mobile/guide/ios/route

Moya URL编码问题

https://github.com/Moya/Moya/issues/1049

UIViewController的touchesBegan事件处理问题

处理弹出对话框时,蒙层点击消失,内容区域点击不处理

    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        super.touchesBegan(touches, with: event)

        if !canMaskViewDismissable {
            return
        }

        var isTouchInner = false
        let list = event?.allTouches?.filter{ $0.view != nil } ?? []
        for t in list
        {
            let loc = t.preciseLocation(in: contentView)
            print(loc)
            if contentView.bounds.contains(loc) {
                isTouchInner = true
                break
            }
        }

        if canMaskViewDismissable, !isTouchInner {
            close()
        }
    }

Fastlane打包上传蒲公英

安装:sudo install fastlane -NV
工程目录下:fastlane init
编辑:Fastfile

default_platform(:ios)

platform :ios do
    puts "============ 打包开始 ==========="
    lane :pkg do |options|

    version = get_info_plist_value(path: "./YourApp/Supports/Info.plist", key: "CFBundleVersion")
    config = options[:to]
    channel = "development"
    env = "Debug"
    
    if config == "appstore"
        channel = "app-store"
        env = "Release"
    end

    gym(
        configuration: "#{env}",
        export_method: "#{channel}",
        silent: true,
        clean: true,
        scheme: "RaveLand",
        output_name: "YourApp_#{channel}_#{version}.ipa",
        output_directory: "./build",
    )
    
    if config == "pgy"
        puts "============ 开始上传蒲公英 ============ "
        pgyer(api_key: "", user_key: "")
        puts "============ 上传蒲公英成功 ============ "
    end
            
    puts "============ 打包完成 ============ "
    system "open ./build"
    
    end
end

蒲公英插件:fastlane add_plugin pgyer
打包:fastlane pkg

Github更新开源库

git add .
git commit -m 'MESSAGE'
git push
git tag x.x.x
git push --tags

pod trunk register EMAIL "USERNAME"
pod trunk push .podspec --allow-warnings --verbose

相关文章

  • iOS | 技术点小记4

    UserDefaults 下标 汉字笔画库 HanZiWriterhttps://hanziwriter.org/...

  • 【iOS】常用技术点小记2

    xcrun: error: unable to find utility "xcodebuild", not a ...

  • 【iOS】常用技术点小记1

    layer.shouldRasterize shouldRasterize instructs Core Anim...

  • iOS | 常用技术点小记(3)

    .ips日志文件分析 终端命令find /Applications/Xcode10.app -name symbo...

  • iOS 开发小记-01

    最近又开始写不少业务代码了,有些小知识点小坑,用这个系列记录一下。iOS 开发小记-01iOS 开发小记-02 1...

  • iOS 开发小记-02

    最近又开始写不少业务代码了,有些小知识点小坑,用这个系列记录一下。iOS 开发小记-01iOS 开发小记-02 1...

  • iOS技术点

    1.版本升级2.开屏广告,信息流广告(包括自研广告,第三方广告接入)3.响应式编程4.内存问题,响应式框架的问题5...

  • 面试技巧攻克(3)-OC高级特性

    面试技术攻克(1)-iOS开发基础 面试技巧攻克(2)-Objective-C语言 面试技巧攻克(4)-iOS中对...

  • iOS技术点列表

    iOS技术点积累 hybrid开发模式 对App提高用户体验、性能调优、防崩溃、节省流量等的方法进行了解; 变成习...

  • iOS交互技术点

    1.侧滑 从iOS7开始,系统为UINavigationController添加 interactivePopGe...

网友评论

      本文标题:iOS | 技术点小记4

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