草庐IT

instance_methods

全部标签

ios - 如何从 NSExpression 的 expressionValueWithObject :context method? 获取 float

我已经实现了一个自定义计算器,我在其中使用以下代码来计算类似5+3*5-3的算术表达式。-(NSNumber*)evaluateArithmeticStringExpression:(NSString*)expression{NSNumber*calculatedResult=nil;@try{NSPredicate*parsed=[NSPredicatepredicateWithFormat:[expressionstringByAppendingString:@"=0"]];NSExpression*left=[(NSComparisonPredicate*)parsedleftE

ios - OCMock "expected method was not invoked"即使我自己调用它

我正在尝试在iOS项目中设置一个简单的OCMock单元测试,以熟悉框架。我有一个模拟的DataLoader类,即使我自己调用该方法,我的期望也失败了:-(void)testSimpleMocking{//Mocktheclassidmock=[OCMockObjectniceMockForClass:[DataLoaderclass]];//Overridethe'dispatchLoadToAppDelegate:'tobeano-op[[[mockstub]andReturn:nil]dispatchLoadToAppDelegate:[OCMArgany]];//Expectth

ios - -[UIImage _imageByUnpremultiplying] : unrecognized selector sent to instance

我在使用CI过滤器时遇到了奇怪的错误,我怎么能通过查看日志来知道我错过了什么CIFilter*filter=[CIFilterfilterWithName:@"CIFalseColor"];[filtersetValue:imageforKey:@"inputImage"];CIColor*myBlue=[CIColorcolorWithRed:0.0green:0.0blue:0.6alpha:0.5];[filtersetValue:myBlueforKey:@"inputColor0"];CIImage*filteredImageData=[filtervalueForKey:@

ios - appname.ViewsVC collectionView :cellForItemAtIndexPath:]: unrecognized selector sent to instance

我正在构建一个CollectionView并收到以下错误。Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'-[appname.ViewsVCcollectionView:cellForItemAtIndexPath:]:unrecognizedselectorsenttoinstance这是我自定义单元格的代码//cellconfigurationfunccollectionView(_collectionView:UICollectionView,cellForItemAtindexPa

iphone - [CFNumber 发布] : message sent to deallocated instance

当我从HistoryCoreData对象记录/请求值时,下面的代码返回以下错误:-[CFNumberrelease]:messagesenttodeallocatedinstance0x17ea2a90我最初认为是其他地方存在问题,并花了无数小时尝试调试它,但没有成功。经过进一步测试,我已将崩溃确定为从HistoryCoreData对象请求某些值。任何人都可以看到为什么要释放对象值的任何问题吗?[[DocumentHandlersharedDocumentHandler]performWithDocument:^(UIManagedDocument*document){if(!self

iphone - 抑制警告 : Meta method xx in category from xx conflicts with same method from another category

如何抑制此编译器警告:“...soap+prefix.o”类别中的元方法“prefix”与另一个类别中的相同方法冲突?这是类别soap+Prefix.h:@interfaceSoap(Prefix)+(NSString*)prefix;@end和soap+prefix.m:#import"Soap.h"#import"Soap+Prefix.h"@implementationSoap(Prefix)+(NSString*)prefix{return@"EInspector";}@end顺便说一句,这两个文件是使用SudZc为Web服务包装器自动生成的。附注此警告仅在XCode4.4中发

ios - ([NSAttributedString boundingRectWithSize :options:context:])method can not get the right size within NSTextAttachment

在我的代码中:NSMutableAttributedString*str=[[NSMutableAttributedStringalloc]initWithString:@"12123"];NSTextAttachment*attachment=[[NSTextAttachmentalloc]init];attachment.image=[UIImageimageNamed:@"002"];attachment.bounds=CGRectMake(0,0,20,20);[strinsertAttributedString:[NSAttributedStringattributedStr

【已解决】JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token;

前后端联调,JSON转换问题JSONparseerror:Cannotdeserializeinstanceof`java.lang.String`outofSTART_ARRAYtoken;【已解决】JSONparseerror:Cannotdeserializeinstanceof`java.lang.String`outofSTART_ARRAYtoken; 上述问题为:前后端联调,类型转换不一致问题 不能将数组等转换为String类型在我进行前后端联调的时候,发现前端传过来的JSON数据为:{"customAttributeItems":[{"text":"wq"}],"name":"

objective-c - removeObjectAtIndex 导致 "message sent to deallocated instance"

我正在将一些代码转换为ARC。该代码在NSMutableArray中搜索元素,然后查找、删除并返回该元素。问题是元素在“removeObjectAtIndex”后立即被释放:-(UIView*)viewWithTag:(int)tag{UIView*view=nil;for(inti=0;i当我运行它时,我得到了***-[UIViewrespondsToSelector:]:messagesenttodeallocatedinstance0x87882f0在第二条日志语句处。在ARC之前,我小心地在调用removeObjectAtIndex:之前保留对象,然后自动释放它。我如何告诉AR

ios - "Unrecognized selector sent to instance"使用自定义表格单元格时

我已经实现了自定义表格单元格,当表格进入cellForRowAtIndexPath时收到运行时错误(“无法识别的选择器发送到实例”)。尝试实例化自定义单元格时发生错误。我之前已经成功地做到了这一点,但现在错误不会消失。我有一个prtotype单元格,它的自定义类属性设置为自定义单元格UITableViewCell子类。这是自定义单元格:#import"FavoriteCell.h"@implementationFavoriteCell@synthesizelblGaugeID,lblMainTitle,bgImage;-(id)initWithStyle:(UITableViewCel