今天XCode里面报了一个错误:
/Developer/Tools/RunPlatformUnitTests.include:393: error: Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/Developer/usr/bin/otest' exited abnormally with code 138 (it may have crashed).
经过跟综才发现是NSMutableArray的问题, 以前用它的时候是先alloc, 再init, 所以没有遇到这个问题。
现在我是这样:NSMutableArray *array = [NSMutableArray arrayWithObjects: @"a", @"b"];
后来才想起来是因为没有在数组里最后一元素后面加nil.应该是这样:
NSMutableArray *array = [NSMutableArray arrayWithObjects: @"a", @"b", nil];
和C里的字符数组一个道理吧。只不过我里是显示的nil。C里是隐式的\0。
分享到:
相关推荐
Objective-C的数组比C++,Java的数组强大在于,NSArray保存的对象可以是不同的对象。但只能保存对象,int ,char,double等基本数据类型不能直接保存,需要通过转换成对象才能加入数组。
NSMutableArray-SafeTransaction NSMutableArray线程安全事务 NSMutableArray不是线程安全的,如果您向每个API添加锁定,则会被包围。 假设这样: 线程1获得可变数组的计数。 线程#2删除最后一个对象。 线程#...
主要介绍了IOS 开发之 NSMutableArray与NSArray 的区别的相关资料,希望通过本文能掌握这部分内容,需要的朋友可以参考下
NSMutableArray-Delegate 是为可变数组添加模式委托的类别。 支持的委托方法 - (void)mutableArray:(NSMutableArray *)array willAddObject:(id)object - (void)mutableArray:(NSMutableArray *)array didAddObject...
下面小编就为大家分享一篇iOS 对NSMutableArray进行排序和过滤的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
Iphone数组一些基础操作 NSArray/NSMutableArrayIphone
NSMutableArray +随机播放NSMutableArray上的一个有用的类别,提供了一种重新排列数组的方法。用法在要添加随机播放功能的类中导入NSMutableArray + Shuffle.h文件。 # import " NSMutableArray+Shuffle.h " 创建...
FFSafeKit安全地使用NSArray,NSMutableArray,NSDictionary,NSMutableDictionary,NSMutableString。 功能安全访问NSArray安全访问NSDictionary安全访问并执行更改FFSafeKit安全地使用NSArray,NSMutableArray,...
NSMutableArray *dataTitleArray=[[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9", nil]; NSMutableArray *dataArray=[[NSMutableArray alloc] initWithObjects:@"86",@"2...
NSMutableArray *dataTitleArray=[[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9", nil]; NSMutableArray *dataArray=[[NSMutableArray alloc] initWithObjects:@"86",@"2...
NSMutableArray *arrImgURL = [[NSMutableArray alloc] init]; int node = [self nodeCountOfTag:@"img"]; for (int i = 0; i ; i ) { NSString *jsString = [NSString stringWithFormat:@"document....
cityListVC.arrayHotCity = [NSMutableArray arrayWithObjects:@"北京",@"上海",@"广州",@"厦门",@"深圳",@"天津",@"长沙",@"郑州", nil]; //历史选择城市列表 cityListVC.arrayHistoricalCity = ...
数组是线性结构是容器类型,是一块连续的内存空间, iOS 中用 NSArray 和 NSMutableArray 集合类型,用来存放对象类型,其中 NSArray是不可变类型, NSMutableArray 是可变类型,能够对数组中元素进行增删改查. ...
NSMutableArray *unselectImages = [[NSMutableArray alloc]initWithObjects:normal_left, normal_right, nil]; [normal_left release]; [normal_right release]; UIImage *select_left = [[UIImage alloc] ...
3 返回NSMutableDictionary或者NSMutableArray,键值封装。 示例见最后的注释。 XML封装类待续。。。 转载请注明来源,谢谢 ====== XmlResolve.h #import <Foundation/Foundation.h> @interface ...
NSMutableArray *images = [NSMutableArray new];[images addObject:[UIImage imageNamed:@"1"]];[images addObject:[UIImage imageNamed:@"2"]];[images addObject:[UIImage imageNamed:@"3"]];[...
NSMutableArray* data = [NSMutableArray new]; for (int i = 0; i ; i ) { JAChartData* unitData = [JAChartData new]; unitData.value = arc4random() % 200; unitData.lableTitle = [NSString ...
NSMutableArray viewsArray [NSMutableArray array]; for int i 0; i < 3; ++i { UIImageView imageView [[UIImageView alloc]initWithFrame:self adViewContainerInPersonalView bounds]; imageView ...
@property (nonatomic, strong) NSMutableArray *attrsArray; /** 存放所有列的当前高度 */ @property (nonatomic, strong) NSMutableArray *columnHeights; /** 内容的高度 */ @property (nonatomic, assign) ...
NSMutableArray * imageList=[NSMutableArray array]; for (NSInteger i=0; i; i++) { NSString *fileName=[NSString stringWithFormat:format,i]; UIImage* image=[UIImage imageNamed:fileName]; [imageList ...