草庐IT

USER_TYPE

全部标签

ios - 惰性变量给出 'Instance member can not be used on type' 错误

我现在多次遇到此错误,并采取了不同的解决方法,但我真的很好奇为什么会发生这种情况。基本场景如下:classSomeClass{varcoreDataStuff=CoreDataStuff!lazyvarsomethingElse=SomethingElse(coreDataStuff:coreDataStuff)}所以我知道我不能在类完全初始化之前使用self,但在这种情况下,我正在使用self属性coreDataStuff来初始化一个惰性变量,这在我的实例准备好之前不会发生。任何人都可以解释我为什么会这样Instancemembercannotbeusedontype错误?

ios - 惰性变量给出 'Instance member can not be used on type' 错误

我现在多次遇到此错误,并采取了不同的解决方法,但我真的很好奇为什么会发生这种情况。基本场景如下:classSomeClass{varcoreDataStuff=CoreDataStuff!lazyvarsomethingElse=SomethingElse(coreDataStuff:coreDataStuff)}所以我知道我不能在类完全初始化之前使用self,但在这种情况下,我正在使用self属性coreDataStuff来初始化一个惰性变量,这在我的实例准备好之前不会发生。任何人都可以解释我为什么会这样Instancemembercannotbeusedontype错误?

ios - Facebook iOS SDK 和 swift : how get user's profile picture

我已经在Xcode6中集成了Facebooksdk(使用swift)。在登录期间,我请求public_profile权限:FBSession.openActiveSessionWithReadPermissions(["public_profile"],allowLoginUI:true,completionHandler:{......所以我请求用户的信息:FBRequestConnection.startForMeWithCompletionHandler{(connection,user,error)->Voidin......为什么用户对象不包含头像?如何获取用户个人资料图片?

ios - Facebook iOS SDK 和 swift : how get user's profile picture

我已经在Xcode6中集成了Facebooksdk(使用swift)。在登录期间,我请求public_profile权限:FBSession.openActiveSessionWithReadPermissions(["public_profile"],allowLoginUI:true,completionHandler:{......所以我请求用户的信息:FBRequestConnection.startForMeWithCompletionHandler{(connection,user,error)->Voidin......为什么用户对象不包含头像?如何获取用户个人资料图片?

ios - swift 3 : Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority'

Swift3.0:在创建调度异步队列时收到错误无法将“int”类型的值转换为预期的参数类型“DispatchQueue.GlobalQueuePriority”DispatchQueue.global(priority:0).async(execute:{()->Voidin}) 最佳答案 警告,这在iOS8中已弃用,请参阅下面的最新信息DispatchQueue.global需要DispatchQueue.GlobalQueuePriority枚举,即:高默认低背景所以在你的情况下,你只需写:DispatchQueue.globa

ios - swift 3 : Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority'

Swift3.0:在创建调度异步队列时收到错误无法将“int”类型的值转换为预期的参数类型“DispatchQueue.GlobalQueuePriority”DispatchQueue.global(priority:0).async(execute:{()->Voidin}) 最佳答案 警告,这在iOS8中已弃用,请参阅下面的最新信息DispatchQueue.global需要DispatchQueue.GlobalQueuePriority枚举,即:高默认低背景所以在你的情况下,你只需写:DispatchQueue.globa

ios - 在 Swift 中导入 Swift 框架 : "Use of undeclared type ' MyCustomView'"

我有一个Swift项目,我在其中添加了一个带有自定义子类UIView的框架目标。所以我可以在Xcode6的InterfaceBuilder中使用新的实时View。但是当我尝试添加@IBOutlet时在我的UIViewController我的项目中的子类出现“使用未声明的类型‘MyCustomView’”错误,我无法构建我的项目。这是来自UIViewController子类的代码:importUIKitimportMyCustomFrameworkclassMyViewController:UIViewController{@IBOutletvarmyCustomView:MyCusto

ios - 在 Swift 中导入 Swift 框架 : "Use of undeclared type ' MyCustomView'"

我有一个Swift项目,我在其中添加了一个带有自定义子类UIView的框架目标。所以我可以在Xcode6的InterfaceBuilder中使用新的实时View。但是当我尝试添加@IBOutlet时在我的UIViewController我的项目中的子类出现“使用未声明的类型‘MyCustomView’”错误,我无法构建我的项目。这是来自UIViewController子类的代码:importUIKitimportMyCustomFrameworkclassMyViewController:UIViewController{@IBOutletvarmyCustomView:MyCusto

swift - "Cannot assign value of type ' 字符串 ' to type ' AnyObject? '", swift 3,Xcode 8 测试版 6

一段相当简单的代码vardict:[String:AnyObject]=[:]dict["key"]="value"生成以下编译时错误Cannotassignvalueoftype'String'totype'AnyObject?'简单的类型检查告诉我String是AnyObject"value"isAnyObject//returnstrue我可以将AnyObject更改为Any并且一切正常vardict:[String:Any]=[:]dict["key"]="value"但我想了解为什么会出现错误?String不再是AnyObject了吗?或者这是一个错误?

swift - "Cannot assign value of type ' 字符串 ' to type ' AnyObject? '", swift 3,Xcode 8 测试版 6

一段相当简单的代码vardict:[String:AnyObject]=[:]dict["key"]="value"生成以下编译时错误Cannotassignvalueoftype'String'totype'AnyObject?'简单的类型检查告诉我String是AnyObject"value"isAnyObject//returnstrue我可以将AnyObject更改为Any并且一切正常vardict:[String:Any]=[:]dict["key"]="value"但我想了解为什么会出现错误?String不再是AnyObject了吗?或者这是一个错误?