Skip to content

Commit 5103000

Browse files
committed
添加Crash in Cocoa
1 parent 9d70024 commit 5103000

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Crash in Cocoa
2+
3+
Cocoa中会导致Carsh的地方:
4+
5+
##1. 集合类越界:
6+
7+
- 数组类型
8+
9+
越界访问会crash
10+
11+
- 字典类型
12+
13+
查询时:
14+
objectForKey,key为nil。能够正常运行。
15+
16+
插入时:
17+
setObject:forKey:。object和key任一为nil,都会crash
18+
19+
- 字符串类型
20+
21+
获取substring时,越界访问会crash.
22+
23+
包括:
24+
25+
~~~objective-c
26+
- (NSString *)substringFromIndex:(NSUInteger)from;
27+
- (NSString *)substringToIndex:(NSUInteger)to;
28+
- (NSString *)substringWithRange:(NSRange)range;
29+
~~~
30+
31+

0 commit comments

Comments
 (0)