草庐IT

qmake-variable-reference

全部标签

swift - 枚举 : Switch case for variables of type

当我尝试打开具有枚举friendstate的optional时,当我尝试在下面的switch语句中应用它时,为什么会出现错误?提供的错误是在类型“friendState!”中找不到枚举案例“已添加”(所有情况下都会出现错误)有没有办法解决这个错误?varusernameText:String!varUID:Int!varuserDetails:UserState?varbuttonText:String{switch(userDetails!.state){case.added:return"remove"//erroroccurscase.incoming:return"accept

ios - iOS Swift 中的 Braintree 插件 : Where to get variable PaymentMethodNonce:

我一直在按照此处的说明操作https://developers.braintreepayments.com/start/hello-client/ios/v4在iOSSwift中将直接支付表单与braintree集成。我的代码如下所示,据我所知,它与文档完全匹配。funcfetchClientToken(){//TODO:SwitchthisURLtoyourownauthenticatedAPIletclientTokenURL=NSURL(string:"https://braintree-sample-merchant.herokuapp.com/client_token")!l

swift - Codable - arrayPropety [AnyObject] : Reference to member 'data' cannot be resolved without a contextual type

设置Codable类。AnyObjects数组产生编译错误:Referencetomember'data'cannotberesolvedwithoutacontextualtypeclassClassA:NSObject,Codable{//MARK:-Propertieslettitle:Stringletdata:[T]//dataisanarrayofeitherCodableobjectsofClassBorClassC.//MARK:-KeyesprivateenumCodingKeys:String,CodingKey{casetitlecasedata}required

swift - 如何消除 "variable not used"警告并保持强引用?

我想在不使用_=DispatchSource.createRepeating并且最好不打印它或在多余的方式。functestTimerIsStarted(){letexpectation=self.expectation(description:#function)lettimer=DispatchSource.createRepeating(interval:0,deadline:DispatchTime.now()){expectation.fulfill()}waitForExpectations(timeout:0.02)}Initializationofimmutableva

ios - "Ambiguous reference to member map"来自具体类型

这是我的代码。它使用来自CoreBluetooth的CBUUID。让我们假设v的转换是有效的。importUIKitimportCoreBluetoothfuncconvert(v:AnyObject)->[String:String]{return(vas![CBUUID:NSData]).map{(uuid,data)in(uuid.UUIDString,NSString(data:data,encoding:NSUTF8StringEncoding)??"")}}想法是通过为CBUUID调用CBUUID.UUIDString并通过调用适当的NSString构造函数来获取字典的字符

ios - Swift + Storyboard : How to keep strong reference to show segue controller?

我有两个Controller:HistoryViewController,它有一个“浏览”按钮。这嵌入在NavigationController中WebBrowserViewController,将通过HistoryViewController中的浏览按钮访问浏览按钮连接正常。当我点击它时,它会将我带到网络浏览器ViewStoryboard。但是,当我按下返回键并再次点击“浏览”按钮时,它总是会生成一个新的Web浏览器View。因此,如果我在Web浏览器View中的某个页面上返回历史View,然后再次点击“浏览”,我总是会返回主页并丢失当前页面。有没有一种方法可以保持对WebBrows

swift - aws appsync 离线 : getting error Variable id was not provided

我正在使用AWSAppSync进行离线/在线功能的移动开发(iOS)我正在尝试在离线模式下保存数据。但我收到错误消息“未提供变量ID/缺少值”当应用程序上线时它会自动同步到DynamoDB但问题仅在离线模式下无法获取保存的记录这是应用程序中使用的代码`letuserObjInput=userObjectInput(id:"id",firstName:"firstname",lastName:"lastName")letCategoryInputs=CreateUserCategoryInput(categoryName:"categoryValue",user:userObjInput

xcode - iOS8.0 的 CompileSwift 状态为 "the current deployment target does not support automated __weak references"

我正努力在Swift应用程序中使用静态库(从ObjectiveC编译)。我有一个包含相关header的ObjectiveC桥接header。构建应用程序时出现此错误../someDirectory/Xcode/FirstSteps/headers/Acme.h:89:thecurrentdeploymenttargetdoesnotsupportautomated__weakreferencesAcme类确实使用弱引用,但部署目标是iOS8.0,它应该支持它们。我是不是找错树了?Acme.h的第89行显示:-(void)addTopicListener:(__weakNSObject*

swift : Updated Variable in a different scene

我的GameScene中有一个变量,它是分数变量,它通过SKLabelNode显示在屏幕上。每次发生碰撞时,分数都会加1,分数会作为字符串传输到SKLabelNode,然后在屏幕上更新。问题是,当我从我的GameOverScene调用它时(最终分数与“游戏结束”一起显示的场景),我得到分数的第一个值,即0。就像GameOverScene正在读取变量,但不是更新了一个。如何获取更新的变量?谁能帮忙?代码:classGameScene:SKScene,SKPhysicsContactDelegate{//SCORE!varscore=0varscoreText:String=""varsc

ios - 段错误 : 11 - Cross-reference to module

我正在尝试通过对模块的交叉引用来解决段错误。不知道如何使这项工作。部分错误如下:1.Whilereadingfrom/Users/damiandudycz/Library/Developer/Xcode/DerivedData/Hypno-azmcjycezcoqnfauqcbgimvipjyj/Build/Intermediates/Hypno.build/Debug-iphonesimulator/Hypno.build/Objects-normal/x86_64/WorldObjectBasedAugmentedRealityObject~partial.swiftmodule2