我正在使用Xcode 8 Beta 4将Swift iOS项目转换为Swift 3.0.绝对值函数显示为不可用.这是一个代码示例......
let myInt = -3
let myAbsoluteInt = abs(myInt)
Run Code Online (Sandbox Code Playgroud)
第二行导致错误说明:'abs' is unavailable: Please use the 'abs(_:)' free function.
想法?
我正在swift和xcode 8中编写自定义集合视图布局.我尝试使用以下函数实现自定义集合视图布局属性
override class func layoutAttributesClass() -> AnyClass {
return CircularCollectionViewLayoutAttributes.self
}
Run Code Online (Sandbox Code Playgroud)
但我得到错误'方法不会覆盖其超类中的任何方法'.任何帮助深表感谢.
应用程序构建时,Xcode iOS模拟器运行速度极慢.UI和响应非常滞后.
我在OSX 10.11.6上使用Xcode 8.0发行版
还有其他人经历过这个吗?如果是这样,任何人都有任何解
我遇到了一个不寻常的行为,我被卡住了一点,问题如下.
我正在使用BWWalkthrough库,以便将4张幻灯片作为启动画面.所以在我的appdelegate中,我有以下代码初始化viewcontrollers:
let storyboard = UIStoryboard(name: "SlidesFlow", bundle: nil)
let walkthrough = storyboard.instantiateViewController(withIdentifier: "SlidesView") as! BWWalkthroughViewController
let page_zero = storyboard.instantiateViewController(withIdentifier: "page_1")
let page_one = storyboard.instantiateViewController(withIdentifier: "page_2")
let page_two = storyboard.instantiateViewController(withIdentifier: "page_3")
let page_three = storyboard.instantiateViewController(withIdentifier: "page_4")
walkthrough.delegate = self
walkthrough.addViewController(page_zero)
walkthrough.addViewController(page_one)
walkthrough.addViewController(page_two)
walkthrough.addViewController(page_three)
Run Code Online (Sandbox Code Playgroud)
一切都按预期工作,所以这里没问题.在viewController page_three上我有一个按钮,使用自定义segue动画将我重定向到另一个视图控制器
class sentSegueFromRight: UIStoryboardSegue {
override func perform()
{
let src = self.source as UIViewController
let dst = self.destination as UIViewController
src.view.superview?.insertSubview(dst.view, aboveSubview: src.view)
dst.view.transform = CGAffineTransform(translationX: src.view.frame.size.width, y: 0)
UIView.animate(withDuration: 0.25,
delay: 0.0,
options: UIViewAnimationOptions.curveEaseInOut, …Run Code Online (Sandbox Code Playgroud) Use of undeclared type 'Transcription'
我正在关注Swift 3中这个简单的核心数据教程(https://learnappdevelopment.com/uncategorized/how-to-use-core-data-in-ios-10-swift-3/)
我在线上得到上述错误: let fetchRequest: NSFetchRequest<Transcription> = Transcription.fetchRequest()
我仔细检查并在我的.xcdatamodeld文件中正确拼写了Entity"Transcription"
本教程是为Swift 3设计的,但是自我发布之后又发生了另一个修改,所以我猜测过去2个月内Swift的其他一些变化导致了这个错误.
我是Core Data的新手,所以我不知道如何调试它.我非常感谢解决方案!
这是我的代码:
if let date = messages?.date{
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "h:mm a"
//let elapseTimeInSeconds = NSDate.timeIntervalSince(date)
let elapseTimeInSeconds = Date(timeIntervalSinceNow: (date as? Date))
let secondsInDays: TimeInterval = 60 * 60 * 24
if elapseTimeInSeconds > secondsInDays {
dateFormatter.dateFormat = "EEE"
} else if elapseTimeInSeconds > 7 * secondsInDays {
dateFormatter.dateFormat = "MM/dd/yy"
}
timeLabel.text = dateFormatter.string(from: date as Date)
}
Run Code Online (Sandbox Code Playgroud)
这是错误:
无法转换"日期"类型的值?预期参数类型'TimeInterval'(又名'Double')
错误在这一行:
let elapseTimeInSeconds = Date(timeIntervalSinceNow: (date as? Date))
Run Code Online (Sandbox Code Playgroud)
我已经尝试过我所知道的并且没有任何效果.请帮忙.
我将一个Swift类声明从一个文件移动到另一个文件,现在Xcode 8.2.1在我使用这个类的任何地方一直用红色错误"使用未声明的类型"唠叨我.该项目确实编译和运行没有错误,但是当我编辑代码时,错误消息再次弹出.
我已经
我还能做些什么来摆脱这些消息吗?
使用新的Xcode 8.3,我收到错误:
无法覆盖扩展中的非动态类声明
在代码行
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
Run Code Online (Sandbox Code Playgroud)
我怎么能避免这个警告?
我想手动删除过期的配置文件,但我不想删除所有配置文件.我想添加新的配置文件,但在新的Xcode 8.3.2中,我只能看到证书,如果我通过双击直接添加配置文件,我该如何检查配置文件的日期.
xcode8 ×10
ios ×7
swift3 ×5
swift ×3
xcode ×3
ios10 ×2
core-data ×1
declaration ×1
instruments ×1
segue ×1
uitableview ×1