草庐IT

has-scope

全部标签

ios - Xcode 错误 "value of type ' [UIViewController ]' has no member ' firstObject'”

我正在尝试创建thisGitHubrepository的Swift版本.我首先将所有代码从Objective-C直接转移到Swift,这导致了很多错误(321行文件中有60个错误)。对于这一行特定的代码self.currentViewController=self.childViewControllers.firstObject我收到这个错误:Valueoftype'[UIViewController]'hasnomember'firstObject'我试过添加as!UIViewController,并在尽可能多的位置放置感叹号和问号。我从建议的帖子中尝试的所有事情都没有帮助。

ios - 当我尝试在函数前添加 private 时,Xcode 报错 "attribute private can only be used in a non local scope"

当我尝试在函数前面添加private时,xcode提示“属性private只能在非本地范围内使用”。我认为“私有(private)”应该用于您想要保留本地权利的事情?有人可以告诉我如何处理错误消息吗?我仍然想将函数保密。 最佳答案 我是通过搜索这个错误attributeprivatecanonlybeusedinanonlocalscope到这里的。在我的例子中,这是由switch语句末尾缺少右括号引起的。希望这对某人有帮助。 关于ios-当我尝试在函数前添加private时,Xcode

swift - 使用 Swift & Stripe 解析云代码 : TypeError: Object [object Object] has no method '_each'

我正在尝试将云代码与strip一起使用,但我从云代码文件中收到错误消息:TypeError:Object[objectObject]hasnomethod'_each'atrequest(stripe.js:58:11)atpost(stripe.js:117:12)atObject.module.exports.Charges.create(stripe.js:157:16)atmain.js:7:18(Code:141,Version:1.8.2)ChargenotworkingOptional("Helloworld!")这是云代码.js文件:varStripe=require(

ios - 无法在 Xcode 中构建,错误为 "[method] has been explicitly marked unavailable"

我在我的项目中没有做任何更改,但在构建到我的设备时突然出现这些错误:'componentsWithURL(_:resolvingAgainstBaseURL:)'isunavailable:useobjectconstruction'NSURLComponents(URL:resolvingAgainstBaseURL:)''componentsWithURL(_:resolvingAgainstBaseURL:)'hasbeenexplicitlymarkedunavailablehere(Foundation.NSURLComponents)在这一行:leturlComponent

ios - Xcode 6.3.1 "A signed resource has been added, modified, or deleted"问题

我的xcode版本是6.3.1,我的应用程序是一个带有WatchKit目标的swift项目。当我在我的iPhone6上运行时,Xcode显示这条消息“已添加、修改或删除了一个签名的资源”。它在iPhone5s、iPad和模拟器上运行良好,所以我想这不是证书问题,对吧?我尝试删除问题xcode6beta7:Asignedresourcehasbeenaddedmodifiedordeleted.中建议的“派生数据”我删除了“deriveddata”后,第一次运行,在“buildsucceeded”后自动停止(应用程序没有安装到我的iPhone),当我再次运行时,消息又出现了。我也试过重启

ios - swift 3.0 : Value of type 'IndexSet' has no member 'enumerateIndexesUsingBlock'

接收“IndexSet”类型的值在enumerateIndexesUsingBlock处没有成员“enumerateIndexesUsingBlock”错误。/**Extensionforcreatingindexpathsfromanindexset*/extensionIndexSet{/**-parametersection:ThesectionforthecreatedNSIndexPaths-return:AnarraywithNSIndexPaths*/funcbs_indexPathsForSection(_section:Int)->[IndexPath]{varind

arrays - 选择要附加到三元运算符 'if' 运算符 : "Immutable value... only has mutating members" 的数组

我有两个数组:varaddedToIgnoreList:[String]=[]varremovedFromIgnoreList:[String]=[]我想将一个值附加到这些数组之一。如果我这样做:(isUserIgnored?removedFromIgnoreList:addedToIgnoreList).append("username")我得到Immutablevalueoftype'[String]'onlyhasmutatingmembersnamed'append'如果我使用中间变量,它会起作用:varwhich=isUserIgnored?removedFromIgnore

ios - [NSBlockOperation addExecutionBlock :]: blocks cannot be added after the operation has started executing or finished

我试图在完成或取消后重新启动NSBlockOperation,但出现错误?任何人都知道错误在哪里?谢谢letimageURLs=["http://www.planetware.com/photos-large/F/france-paris-eiffel-tower.jpg","http://adriatic-lines.com/wp-content/uploads/2015/04/canal-of-Venice.jpg","http://algoos.com/wp-content/uploads/2015/08/ireland-02.jpg","http://bdo.se/wp-con

ios - 错误 : Type 'String!' has no member 'video'

importUIKitimportAVKitclassViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()//startcameraletcaptureSession=AVCaptureSession()guardletcaptureDevice=AVCaptureDevice.default(for:.video)else{return}guardletinput=try?AVCaptureDeviceInput(device:captureDevice)else{return}ca

iOS swift : App Transport Security has blocked a cleartext HTTP (http://) resource

晚上,我正在开发一个基于SWAPI的应用程序(星球大战api:https://swapi.co/documentation)我收到了ATS错误:应用程序传输安全已阻止明文HTTP(http://)资源加载,因为它不安全。可以通过应用的Info.plist文件配置临时异常(exception)。我不明白为什么。我的baseURL是https格式structNetworkManager{letbaseURL="https://swapi.co/api/"letsession=URLSession(configuration:.default)funcfetchEndpoint(endpoi