草庐IT

optional-arguments

全部标签

【已解决】TypeError: __init__() takes 1 positional argument but 3 were given

问题描述TypeError:__init__()takes1positionalargumentbut3weregiven类型错误:__init__()函数需要1个参数,但给出了3个参数问题分析本人练习的代码中,其父类__init__()函数中的参数只有一个(个人原因少写了!),而在其子类实际调用的的参数需要三个,所以在调用的时候出现此类报错。查找其他问题解决方法时,发现大概有以下错误原因导致此类相关报错:1.函数传参时,父类或子类参数少些或多写,应都检查一遍(本人错误),例如,类初始化时__init__(self)只有一个参数,其子类的__init__(self,type,no,compan

objective-c - Objective-C : Sending arguments to a method called by a UIButton

我有一个在单击UIButton时调用的方法。当我创建按钮时,我希望它存储一个NSTimer作为参数。这是计时器和UIButton的创建。我将如何添加要发送到该方法的计时器?我试过withObject:timer但它给了我一个警告并在运行时崩溃。NSTimer*timer=[NSTimerscheduledTimerWithTimeInterval:(0.009)target:selfselector:@selector(moveStickFig:)userInfo:stickFigrepeats:YES];[stickFigaddTarget:selfaction:@selector(

ios - 移动到 Xcode 7 后为 "Installation Failed: Invalid Argument"

同意Xcode7中的“升级到推荐设置”对话框后,我的应用程序构建但不再在模拟器上运行。模拟器正常启动,但只是位于主屏幕上。同时,Xcode显示错误:InstallationFailedInvalidArgument 最佳答案 发生这种情况是因为“升级到推荐设置”会将info.plist的CFBundleIdentifier更改为指向$(PRODUCT_BUNDLE_IDENTIFIER)而不是旧的$(BUNDLE_IDENTIFIER)。Apple在Xcode7发行说明中表示,PRODUCT_BUNDLE_IDENTIFIER现在是

ios - Xcode 10 : Where is the don't code sign option in Code Signing Identity

我正在以未签名的XCArchive的形式为客户端构建一个UnityiOS应用程序,因为客户端出于安全原因手动签署XCArchive。我事先遵循了本指南:HowtobuildandsignaniOSapponseparatemachines?但是我最近更新了Xcode到10.0,现在Target->BuildSettings->CodeSigningIdentity下的don'tcodesign选项不见了,这在构建XCArchive时有点问题。如何在没有不代码签名选项的情况下构建XCArchive? 最佳答案 只需选择:其他删除那里写

objective-c - Unicode 格式化编译器警告 : Format specifies type 'unsigned short' but the argument has type 'int'

有点强制症,但我讨厌收到任何编译器警告。当我更新XCode时,我开始收到此编译器警告:Formatspecifiestype'unsignedshort'buttheargumenthastype'int'当我尝试使用以下代码包含学位的Unicode字符时:currentVal=[NSStringstringWithFormat:@"%.2f%C",angleDeg,0x00B0];如何通过更改代码或关闭特定的编译器警告来消除编译器警告? 最佳答案 将字面量转换为unichar:currentVal=[NSStringstringW

LeetCode #1359 Count All Valid Pickup and Delivery Options 有效的快递序列数目

1359CountAllValidPickupandDeliveryOptions有效的快递序列数目Description:Givennorders,eachorderconsistinpickupanddeliveryservices.Countallvalidpickup/deliverypossiblesequencessuchthatdelivery(i)isalwaysafterofpickup(i).Sincetheanswermaybetoolarge,returnitmodulo10^9+7.Example:Example1:Input:n=1Output:1Explanati

ios - 链接错误 : unknown option character `X' in: -Xlinker

以下链接器命令导致以下错误。这是为iOS的XCode中的模拟器目标构建的。目前还不清楚是什么通过XCode提供Xlinker参数。关于我如何在这里寻求解决方案的任何想法?/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool-static-arch_onlyi386-syslibroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Develop

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 - NSPredicate predicateWithFormat :argumentArray: Only Evaluating First Argument

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

ValidationError: Progress Plugin Invalid Options

ValidationError:ProgressPluginInvalidOptions前面一篇文章说明了我当时解决测试组件命令时遇到问题的方案,其中最核心的一部分起始是降低了less-loader的版本,但是当我开发完成组件(当然,开发小组件期间的测试组件代码仍很舒服)然而,最后想要使用命令npmrunserve打开整个项目的开发服务器的时候,又出现问题了:ValidationError:ProgressPluginInvalidOptionsoptionsshouldNOThaveadditionalpropertiesoptionsshouldNOThaveadditionalprope