
Swift
大大大大大桃子
这个作者很懒,什么都没留下…
展开
-
关于Swift@IBOutlet连线生成的属性系统自动解包问题
关于连线拖出来的属性后面默认带叹号和为什么我们一开始不需要给它赋值问题 @IBOutletweak var display: UILabel! 因为系统自动帮你初始化了,display是一个optional,并且在使用之前就赋了nil.对于optional后面一般不是问号吗?但是对于实际类型而言它们没有什么区别.它仍然是一个option原创 2015-06-25 12:41:00 · 2691 阅读 · 0 评论 -
Swift 集合类型(Collection Type) 之 数组(array)(官方文档翻译及总结)
Swift 集合类型(Collection Type) 之 数组(array)(官方文档翻译及总结) ‘[NSObject]’ is not convertible to ‘[String]'原创 2015-07-15 12:22:20 · 1753 阅读 · 0 评论 -
Swift 集合类型(Collection Type) 之 set(官方文档翻译及总结)
Swift 集合类型(Collection Type) 之 set(官方文档翻译及总结)原创 2015-07-15 14:41:29 · 1974 阅读 · 0 评论 -
iWatch error: Embedded binary's bundle identifier is not prefixed with the parent app's bundle ident
error: Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier.错误原因: iPhone APP, watch APP 和 watch extension 三者的bundle ID 不符合苹果的命名规范.其命名规范必须遵循固定的格式.原创 2015-08-01 15:47:23 · 9628 阅读 · 0 评论 -
X-code7 beta error: warning: Is a directory
X-code7 beta error: warning: Is a directory原创 2015-08-01 19:12:26 · 1077 阅读 · 0 评论 -
error: WatchKit App doesn't contain any WatchKit Extensions whose WKAppBundleIdentifier matches "***
error: WatchKit App doesn't contain any WatchKit Extensions whose WKAppBundleIdentifier matches "*****". Verify that the value if WKAppBundleIdentifier in your WatchKit Extension's Info.plist matches the value of CFBundleIndetifier in your WatchKit App's I原创 2015-08-01 19:21:14 · 6076 阅读 · 0 评论 -
Error: An App ID with identifier "*****" is not avaliable. Please enter a different string.
Error: An App ID with identifier "*****" is not avaliable. Please enter a different string.错误原因是这个bundle ID已经被别人提前占用了.这种错误一般发生在你运行别人的项目.原创 2015-08-03 10:42:14 · 17941 阅读 · 0 评论 -
Xcode 报错: Extra argument in call
Xcode 报错: Extra argument in call原创 2015-08-04 11:49:59 · 5491 阅读 · 0 评论 -
Xcode 报错: value of type InerfaceController does not conform to HKWorkoutSessionDelegate in assignmen
Xcode报错: value of type ‘InerfaceController’ does not conform to ‘HKWorkoutSessionDelegate’ in assignment 如果你遇到类似错误,并找到这篇文章的话,请自己抽自己一个大嘴巴子,这是因为你没有遵循相应的协议.同样对于”Cannot assign value of type ‘InterfaceCont原创 2016-01-20 15:09:33 · 807 阅读 · 0 评论 -
Cannot assign value of type 'InterfaceController' to type 'HKWorkoutSessinDelegate'
Xcode报错: Cannot assign value of type ‘InterfaceController’ to type ‘HKWorkoutSessinDelegate’ 如果你遇到类似错误,并找到这篇文章的话,请自己抽自己一个大嘴巴子,这是因为你没有遵循相应的协议.同样对于”value of type ‘InerfaceController’ does not conform to原创 2016-01-20 15:22:59 · 2367 阅读 · 1 评论 -
Xcode 报错: Type '**Controller' does not conform to '**Delegate
Xcode 报错 Type InterfaceController does not conform to HKWorkoutSessionDelegate. 在Swift中,必须实现代理的所有required方法,否则就会报上述错误.拿tableView举个栗子(因为HKWorkoutSessionDelegate就两个方法还都是required的),下面所有required的方法都必须实现,否原创 2016-01-20 15:43:47 · 996 阅读 · 0 评论 -
Swift 集合类型(Collection Type) 之 字典(dictionary)(官方文档翻译及总结)
Swift 集合类型(Collection Type) 之 字典(dictionary)(官方文档翻译及总结)原创 2015-07-15 18:27:02 · 1143 阅读 · 0 评论 -
Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForward
Swift编译错误: Cannot find an initializer for type '[(String)]' that accepts an argument list of type '(LazyForwardCollection<MapCollectionView<Dictionary<Int, String>, Int>>)'原创 2015-07-15 18:05:34 · 1698 阅读 · 0 评论 -
Swift Compiler Error Cannot assign to the result of this expression
Swift Compiler Error Cannot assign to the result of this expression原创 2015-07-08 10:38:00 · 1272 阅读 · 0 评论 -
Swift 元组
元组可以把多个值合成一个复合值.元组内的值可以是任意类型,而且不要求是相同类型. 用处: 1. 作为函数的返回值.可以同时返回多个不同类型的值. 2. 快速交换2个相同类型的值.注意: 元则一般用于临时组织值,并不适合创建复杂的数据结构. 1. 创建元组 let myAge = ("I"原创 2015-07-06 16:20:59 · 557 阅读 · 0 评论 -
swift 断言(assert)
swift 断言(assert)原创 2015-07-06 18:03:14 · 833 阅读 · 0 评论 -
Swift Compiler Error Binary oprator '+' cannot be applied to operands of type 'UInt16' and 'UInt8'
Swift Compiler Error Binary oprator '+' cannot be applied to operands of type 'UInt16' and 'UInt8'Swift Compiler Error Binary oprator '+' cannot be applied to operands of type 'Int' and 'Double'原创 2015-07-06 11:30:20 · 1597 阅读 · 0 评论 -
Swift 如何将数字型字符串转换成String类型 (toInt()方法) 及返回值未解包的原因
Swift 如何将数字型字符串转换成String类型 (toInt()方法) 及返回值未解包的原因原创 2015-07-06 18:33:41 · 2336 阅读 · 0 评论 -
Swift Error fatal error: unexpectedly found nil while unwrapping an Optional value
Swift Error fatal error: unexpectedly found nil while unwrapping an Optional value 强制解包(forced unwrapping)原创 2015-07-07 10:49:37 · 13994 阅读 · 0 评论 -
Swift 的nil
Swift 的nil原创 2015-07-07 11:49:01 · 3718 阅读 · 0 评论 -
Swift Compiler Error Type 'int' does not conform to protocol 'Boolean Type'
Swift Compiler Error Type 'int' does not conform to protocol 'Boolean Type'原创 2015-07-06 14:55:45 · 1784 阅读 · 0 评论 -
Swift Compiler Error Integer literal overflows when stored into 'UInt8'
Swift Compiler Error Integer literal overflows when stored into 'UInt8'原创 2015-07-06 11:56:29 · 2438 阅读 · 0 评论 -
Swift Compiler Error Arithmetic operation '** ' (on type '**') results in an overflow (溢出运算符'&+')
Swift Compiler Error Arithmetic operation '****** ' (on type '****') results in an overflow 错误代码:错误原因是数值运算中出现溢出情况.其结果超过了UInt8的0~255的范围. 和OC不同的是默认不允许在运算中数值溢出.但可以使用溢出运算符来运算原创 2015-07-07 16:11:49 · 2593 阅读 · 0 评论 -
Swift 3.0 UIAlertController的使用
代码如下:let alert = UIAlertController.init(title: "提示", message: "我是弹框..", preferredStyle: .alert)alert.addAction(UIAlertAction.init(title: "取消", style: .cancel, handler: nil))self.present(alert, animat原创 2016-11-13 22:28:53 · 2455 阅读 · 0 评论