awesome-tips / ios-tips Goto Github PK
View Code? Open in Web Editor NEWiOS知识小集
License: MIT License
iOS知识小集
License: MIT License
获取相册图片信息时
-requestImageDataForAsset:options:resultHandler:
resultHandler
里面的 info
中不在包含 文件路径[捂脸]
即不在包含Key PHImageFileURLKey
iOS13 新提供的API 也没有返回文件路径
requestImageDataAndOrientationForAsset:options:resultHandler:
鼓气鼓气鼓气,怕啦怕啦怕啦,跑啦跑啦跑啦!
Example:
- (void)playAction:(MPRemoteCommand *)sender {
// do something
}
- (void)func {
MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];
// crash here
[commandCenter.playCommand addTarget:self action:@selector(playAction:)];
}
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported action method signature. Must return MPRemoteCommandHandlerStatus or take a completion handler as the second argument.'
https://forums.developer.apple.com/thread/121540
Fix in iOS 13:
- (MPRemoteCommandHandlerStatus)playAction:(MPRemoteCommand *)sender {
// do something
return MPRemoteCommandHandlerStatusSuccess;
}
如题
公司使用bugly来统计Crash,有些bug 无法解决,Sigxxx 等类型的bug
选自:swift-algorithm-club
public class RBTreeNode<T: Comparable>: Equatable {
}
类定义泛型和协议的使用
建议统一制作一个类似 swift-evolution 的 proposal 模板。
如题,我们会积极回复反馈您的建议,主题不限于技术。我们会关注有意义建议,拒绝恶意攻击!!!
RT,
项目中总有些请求需要附带认证header。当token过期后,可以通过refreshtoken刷新获得新的token;当refreshtoken过期后,则需要强制退出重新登录。针对这个业务逻辑,在使用离散型的网络层设计中,如何更优雅的处理呢?
比如swift的一些知识点,随着版本的不断更新,老的知识点也许并不适用于最新的swift版本了,举例说明一下这种可能性的出现,是否会对老的知识点修正?
这帮人整些没什么软用的东西。还以为好伟大。“知识小集”点子不错,初衷不错,内容太一般。
选自:swift-algorithm-club
public convenience init(key: T?) {
self.init(key: key, leftChild: RBNode(), rightChild: RBNode(), parent: RBNode())
}
初始化方法的使用(convenience)
iOS代码混淆 防反编译 防渗透等安全方面的实用方案 和实例.现在除了商业化的,貌似一些免费的在这方面的支持内容过旧和过少了比如ios-class-guard,PPiOS-Rename等
在「10」的「9. 判断是否在主队列运行」中也可以用如下方法判断,对比 queue
的 label
BOOL IsMainQueue() {
return strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(dispatch_get_main_queue())) == 0;
}
来自 @姚七六
编译了libobjc.A.dylib库,然后创建一个debug的target依赖这个运行时库的target,然后在debug程序的代码中调用runtime方法就会调用自己编译的库里面的方法,这样来调试运行时库。问题是为什么没有调用系统libobjc.dylib库?是没有链接系统运行时库,还是系统运行时库被自己编译的这个库替换掉了?
首先,感谢各位大神的分享,分享精神**!
在2018年总目录下
有个 "利用 Custom event 解决一个小问题" 这个问题归为2月份,但是实际解答在1月份合集的倒数第二个,貌似是跟 "使用AVCaptureSession踩的一个坑" 的位置颠倒了.
不影响阅读,但是我有强迫症...😂
WiKi不知道怎么发表评论,借用了一下这里的issue
如题。。。
或者说弄成博客?这样搜索也方便一些,等内容多了,后期会管理不过来。哈哈哈哈
希望各位大牛们能介绍一些 CloudKit 使用技巧,非常感谢!
来自 @Augus, 如题
微博网友 @钟冬V5 投稿,
问题:NSData 的 description 方法在 iOS 13之前可以把data转成string,iOS 13就不行了
解决方法
- (NSString *)hexadecimalString: (NSData *)data {
const unsigned char *dataBuffer = (const unsigned char *)[data bytes];
if (!dataBuffer) {
return [NSString string];
}
NSUInteger dataLength = [data length];
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
for (int i = 0; i < dataLength; ++i) {
[hexString appendFormat:@"%02x", (unsigned int)dataBuffer[i]];
}
return [NSString stringWithString:hexString];
}
let lock = NSRecursiveLock()
var recursiveMethod: ((Int) -> Void)! = nil
recursiveMethod = { value in
defer {
lock.unlock()
}
lock.lock()
guard value > 0 else {
return
}
print(value)
sleep(2)
recursiveMethod(value - 1)
}
DispatchQueue.global().async {
print("start")
recursiveMethod(5)
print("end")
}
There is now a selectedSegmentTintColor
on UISegmentedControl
. If you want to change the color of the selected segment, you should use selectedSegmentTintColor
on iOS 13. setTintColor
will not work.
eg:
if #available(iOS 13.0, *) {
segmentControl.selectedSegmentTintColor = UIColor.white
segmentControl.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.black], for: .normal)
} else {
tabBar.tintColor = UIColor.white
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.