草庐IT

first_x_method

全部标签

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 - Storyboard警告 : First baseline layout attribute before iOS 8. 0

我不知道如何摆脱这个警告,我正在使用一个包含许多ViewController(带有标签、文本字段和许多约束)的Storyboard,所有这些ViewController都是以几乎相同的方式创建的。当我点击警告时,它会突出显示scrollView中的UILabel:这个scrollView有很多带有约束的UILabel,我尝试了所有我能找到的东西,包括:AttributeUnavailable:FirstbaselinelayoutattributeoniOSversionspriorto8.0这个警告不会导致我的应用程序崩溃,我已经在模拟器和iPhone4(ios7.1.2)上试过了。

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 - addressDictionary 已弃用 : first deprecated in iOS 11. 0 - 使用@properties

我正在使用获取位置和地址。因为我已成功获取位置,但在获取地址时我收到类似警告,'addressDictionary'isdeprecated:firstdeprecatediniOS11.0-Use@properties有什么解决办法吗... 最佳答案 在swift5中//letlocation:CLLocation=CLLocation(latitude:16.511131,longitude:80.658725)//Convertlat&lngintoCLLocationletgeocoder=CLGeocoder()geoco

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

iphone - 行动 :@selector(showAlert:) how to pass parameter in this showAlert method?

我正在向我的UITableViewCell添加自定义按钮。在该按钮的操作中,我想调用showAlert:函数并希望在该方法中传递单元格标签。如何在showAlert方法中传递参数:action:@selector(showAlert:)? 最佳答案 如果您在Tableviewcell中使用Button,那么您必须将标签值添加到每个单元格的按钮,并使用id作为参数设置方法addTarget。示例代码:您必须在cellForRowAtIndexPath方法中键入以下代码。{//Settagtoeachbuttoncell.btn1.ta

ios - NSPredicate predicateWithFormat :argumentArray: Only Evaluating First Argument

我在使用NSPredicatepredicateWithFormat:argumentArray时遇到了一些问题:。在此示例中,serverIDList是字符串数组。结果是一个NSManagedObjects数组,其属性名为“flid”,它是一个字符串。NSMutableString*predicateString=[[NSMutableStringalloc]init];[predicateStringappendString:@"(flidIN%@)"];[resultsfilterUsingPredicate:[NSPredicatepredicateWithFormat:pre