Nix 的自我修养


  • Home

  • Tags

  • Archives

机器学习的应用场景

Posted on 2018-03-02 | | Visitors:

机器学习简介

机器学习是一种能够直接从数据中学习,而无需依赖规则编程的算法。不同于传统的程序开发方式,你不需要告诉程序应该怎么做(甚至你也不知道应该怎么做),只要提供数据来训练模型。因此机器学习能做到以传统开发模式不能或很难完成的任务。

Read more »

Workflow 添加到主屏幕是如何实现的

Posted on 2018-02-02 | | Visitors:

大名鼎鼎的 iOS 平台的 Workflow 是一款将各个 app 打通,实现自动化完成一系列动作的应用,类似于 macOS 上 Automator。如果你还没有试过,强烈推荐你体验一下。这个 app 已经被苹果收购,可以免费下载。

我发现 Workflow 有个保存到主屏幕的功能挺有意思,研究了一下。

Read more »

iOS 中的分享

Posted on 2018-01-31 | | Visitors:

分享内容

国内主流 app 的分享功能都是自定义的,这样做的考虑主要是为了让流量留在自己的生态中,另一方面 UIActivityViewController 不太符合国人的使用习惯。

相比之下,国外的 app 如 Twitter,使用的都是苹果从 iOS 6 开始引入的 UIActivityViewController。

UIActivityViewController

如果你的 app 面向国外用户,UIActivityViewController 了解一下。:)

Read more »

Weak Linking

Posted on 2017-08-26 | | Visitors:

最近我们的 app 在 iOS 8 上有一个启动 crash 的问题,原因是启动加载动态库时找不到 Network Extension 的符号,这个符号是 iOS 9 引入的。报错类似这样:

1
2
3
4
5
6
Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_NEPacketTunnelFlow
Referenced from: /private/var/mobile/Containers/Bundle/Application/610BA4A6-D057-4F6B-AA80-907827D2B24E/xxx.app/Frameworks/NEKit.framework/NEKit (which was built for iOS 9.3)
Expected in: /System/Library/Frameworks/NetworkExtension.framework/NetworkExtension
in /private/var/mobile/Containers/Bundle/Application/610BA4A6-D057-4F6B-AA80-907827D2B24E/xxx.app/Frameworks/NEKit.framework/NEKit
Dyld Version: 353.5

解决的方法是使用 Weak Linking。在 Xcode 的 Linked Frameworks and Libraries 中将 Network Extension 的 Status 修改成 optional,再重新编译 NEKit 即可。

Read more »

iOS 组件化

Posted on 2017-05-06 | | Visitors:

看完 Limboy(蘑菇街 App 的组件化之路) 和 Casa(iOS应用架构谈 组件化方案) 关于 iOS 上模块化的讨论,以及 Bang(iOS 组件化方案探索)的总结,整理一下。

Read more »

跨子网、不依赖多播的 AirPlay 镜像

Posted on 2017-03-05 | | Visitors:

AirPlay 是苹果的一个私有标准,可以用来将 iDevice(iPhone、iPad、iPod) 上的音视频流或者镜像投射到 Apple TV 上。尽管 AirPlay 协议是私有的,但国内主流的机顶盒,如天猫魔盒、小米盒子等都对其提供了支持。

AirPlay 有一个很大的局限性:只能在 Apple TV(或者支持 AirPlay 的机顶盒)与 iDevice 处在同一子网内才能工作。之所以有这个限制,是因为 AirPlay 的服务发现部分基于 Bonjour。

Read more »

iOS Animation 指北

Posted on 2017-02-13 | | Visitors:

写在前面

iOS 向来以丝般顺滑的过度动画闻名,好的动画可以让用户更好地理解 app,并且可以让 app 更加有趣。有趣很重要。

iOS 动画(或者所有动画?)的原理简单来讲有两种:

  1. 告诉系统动画对象在某几个时刻的状态(关键帧),由系统自动补全这些时刻之间的中间状态,再把所有这些状态平滑地显示出来。这种动画也叫做关键帧动画。
  2. 每隔一段很短的时间,重新绘制一次动画对象。
Read more »

AOP 及应用

Posted on 2016-07-20 | | Visitors:

什么是 AOP

Wikipedia 上的 AOP 定义:

In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding additional behavior to existing code (an advice) without modifying the code itself, instead separately specifying which code is modified via a “pointcut” specification, such as “log all function calls when the function’s name begins with ‘set’”. This allows behaviors that are not central to the business logic (such as logging) to be added to a program without cluttering the code core to the functionality. AOP forms a basis for aspect-oriented software development.

AOP(Aspect Oriented Programming,国内多译作「面向切面编程」),它是在不修改原有代码的前提下给程序添加功能的一种技术。这样可以将一些重复而又与主要业务逻辑无关的代码抽离出来,减少了耦合性,增加了代码复用性。

Read more »

初识 Run Loop

Posted on 2016-05-31 | | Visitors:

Run loop 类似 Windows 中的消息循环,作用是管理线程,让线程可以接收、处理消息,在没有工作时休眠。

下图是 run loop 模型:

Run loop 模型

图片来源

Read more »

消除引入第三方 Framework 导致的 Warning

Posted on 2016-05-09 | | Visitors:

最近在引入了一个 framework 后,在 Generate dSYM 的时候报出了大量的 warning:

1
warning: (armv7) /Users/USERNAME/Library/Developer/Xcode/DerivedData/FRAMEWORKNAME-gizpafzckwvhuigzyzdtbpcvryue/Build/Intermediates/FRAMEWORKNAME.build/Debug-iphoneos/FRAMEWORKNAME.build/Objects-normal/armv7/SOMECLASS.o unable to open object file: No such file or directory

在 Xcode 查看编译过程发现是执行 dsymutil 这条命令时产生的。

dsymutil links the DWARF debug information found in the object files for an executable exe_path by using debug symbols information contained in its symbol table.

Read more »
123…6
Nix Wang

Nix Wang

60 posts
28 tags
© 2018 Nix Wang
Powered by Hexo
|
Theme — NexT.Pisces v6.0.3