How to improve iOS development skills
1. Read the blog: https://github.com/tangqiaoboy/iOSBlogCN more than 40 iOS development blogger blog address
2, reading: reading one book a year to develop high-quality iOS
3, see the video WWDC
4, look at Apple official documentation
5, to see open source project code
6, write the code, think more about
7, and more and peer exchange
8 Share
The first part: iOS development tools
1, Reveal interface debugging tool
1, the virtual machine integrated
2, integrated real machine (iOS development of advanced P47)
vim ~/.lldbinit
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
2, mobile statistical tools
Foreign: Flurry (not the wall)
Domestic: Friends of the Union
3, crash statistics tool
Crashlytics
Bugly (Tencent)
4, App Store statistical tools
App Annie
The second part: iOS development practices
1, CoreFoundation object memory management
- CFStringRef
CFStringCreateWithCString(kCFAllocatorDefault, “Hello World”, kCFStringEncodingUTF8)
CF selected objects into the object OC
- __bridge: only type conversion, not modify object's reference count, the original CF objects when not need to call methods CFRelease
- __bridge_retained: After conversion type, the reference count is incremented related objects, the original CF objects when not need to call methods CFRelease
- __bridge_transfer: after type conversion, object reference count to the ARC management, CF objects when not in use, do not need to call the method CFRelease
2、GCD
- The implementation of a
dispatch_once
code hints - Delay the execution of
dispatch_after
code hints - Custom queue
dispatch_queue_t urls_queue = dispatch_queue_create(“blog.devzhang.com”, NULL);
dispatch_async(urls_queue, ^{
});
dispatch_release(urls_queue);
- Multi-threaded processing, final summary results (specific use?)
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^{
// 并行执行的线程一
});
dispatch_group_async(group, dispatch_get_global_queue(0, 0), ^{
// 并行执行的线程二
});
dispatch_group_notify(group, dispatch_get_global_queue(0, 0), ^{
// 汇总结果
});
1, NSJSONSerialization
than NSKeyArchiver
better
When selecting persistence scheme, the system provides a
NSJSONSerialization
ratio ofNSKeyArchiver
the volume and efficiency are better.
NSJSONSerialization
ThanNSKeyArchiver
faster 7 times, small half
-line detailed test: https://github.com/randomsequence/NSSerialisationTests
2, caution Block
block
Easy to produce a circular reference problem
from an architectural perspective, if you are usingblock
when needed constant attention to avoid the circular reference problem. So might as well not useblock
. Usedelegate
to achieve to secure more
Note: class method can not produce a circular reference!