草庐IT

2Classes1Method

全部标签

ios - 如何将多个参数与 performSelector : method? 一起使用

这个问题在这里已经有了答案:iOSperformSelectorOnMainThreadwithmultiplearguments(3个答案)关闭9年前。我是否使用withObject:?如果是这样,我可以直接通过NSNumber吗?它如何出现在方法的签名中?-(void)methodName:(NSTimer*)timerwithObject:(NSNumber*)value{}

ios - -[__NSCFDictionary setObject :forKey:]: mutating method sent to immutable object

运行以下代码时,[dictsetValue:@"null"forKey:@"name"];一直崩溃。我在这里搜索,发现其他帖子是由不使用NSMutableDictionary的人引起的。但是我正在使用它。如果name为null,为什么会在这一行崩溃?NSMutableArray*tempCustomers=[[NSMutableArrayalloc]init];for(NSMutableDictionary*dictin[[jsonobjectForKey:@"data"]mutableCopy]){if([dictobjectForKey:@"name"]==[NSNullnull]

ios - 非公开 API 使用 : Apps are not permitted to access the UDID and must not use the uniqueIdentifier method of UIDevice

在Xcode6.3中验证我的应用程序时,出现以下错误:没有第三方框架,例如AdMob、GoogleAnalytics、Flurry或Facebook,在应用程序中使用。仅使用内置框架。此外,应用中使用的框架是最新的。我在终端中尝试了以下命令来查找使用UDID的类;find.|grep-v.svn|grep".a"|grep-v".app"|xargsgrepuniqueIdentifier但没有此类文件的列表。我还在我的代码中搜索了**[[UIDevicecurrentDevice]uniqueIdentifier]**,但它没有在任何地方使用。那么我应该怎么做才能解决这个问题呢?

iOS SDK : Renaming a lot of classes

我正在开发一个集成了其他SDK(例如FacebookSDK3.5)的iOSSDK。为了防止冲突并允许我的客户也导入这些SDK,我想重命名我的代码中的所有类/枚举(例如,将FBSession重命名为RDFBSession等)。有没有一种简单的方法可以做到这一点,而不是逐个类地使用Xcode的重命名功能? 最佳答案 Apple提供了一个名为tops(1)的命令行工具设计用于编写大规模代码重构脚本(重命名C函数、Objective-C方法、类和其他标记):tops-verbosereplace"FBSession"with"RDFBSes

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

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

ios - React Native 等同于适配 size classes?

在Swift中为iOS开发时,我可以将属性和约束配置为仅适用于某些尺寸类别。例如,如果水平约束,我可以将View的宽度修改为200,如果水平规则,则修改为400。或者我可以adaptastackviewtobeeitherhorizontalorverticalbasedonthesizeclass.我检查了文档和SO,但在ReactNative中找不到类似的功能。它存在吗?如果是这样,我该如何使用它? 最佳答案 该功能不是ReactNative的一部分,因为ReactNative使用Yoga,这是一种完全不同于基于约束的iOS自动

ios - 代码 8 : Vary for traits changing layout for all size classes

我正在尝试在xcode8.2.1上使用veryfortraits功能,但是当我使用'varyfortraits'更改一个尺寸类的布局,然后在完成时'donevarying'实际上改变了布局我的Storyboard中的每个大小类(class)。例如我尝试通过选择varyfortraits来更改ipadw:R,h:R的约束,将底部的栏变成蓝色。我进行了必要的更改并单击“完成更改”以更改约束。但是,如果我选择其他设备尺寸(例如iphone7),则调整后的约束也会应用于此尺寸类别。我该如何阻止这种情况发生?为了澄清,我在Storyboard中选择了“使用特征变体”和“使用自动布局”。