标签: xcode8

Swift 3迁移 - 双扩展舍入问题

我正在将我们的代码库迁移到Swift 3,我遇到了一个无法解释或修复的编译问题.

我在Double扩展中有一个方法,Double可以将数字舍入到一定数量的数字:

public func roundToPlaces(places: Int) -> Double {
    let divisor = pow(10.0, Double(places))
    return round(self * divisor) / divisor
}
Run Code Online (Sandbox Code Playgroud)

例如: 12.34567.roundToPlaces(2)应该返回12.35.但是,我收到round此扩展中使用的方法的编译问题.这是说我Cannot use mutating member on immutable value: 'self' is immutable.

编译错误图像

关于这里发生了什么的任何想法?我该如何解决这个问题?

double rounding swift3 xcode8

2
推荐指数
1
解决办法
1005
查看次数

Xcode 8 - symbolicatecrash失败

在Xcode 8 symbolicatecrash下分析崩溃报告失败:

sh: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun: No such file or directory
## Warning: can't find tool named 'otool' in iOS SDK, falling back to searching the Mac OS X SDK
sh: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun: No such file or directory
Error: can't find tool named 'otool' in the macosx SDK or any fallback SDKs at /usr/local/bin/symbolicatecrash line 115.
Run Code Online (Sandbox Code Playgroud)

怎么解决?

symbolicatecrash xcode8

2
推荐指数
1
解决办法
2699
查看次数

Crashlytics Xcode 8的Shell脚本调用错误

当我尝试在我的xcode 8项目中运行脚本时,我收到此错误

Shell脚本调用错误

我知道如何在xcode中安装Fabric,我已成功安装在xcode 7中的许多项目中没有问题.但现在在xcode 8的新项目中我得到了这个错误.

当我删除脚本时,根本没有错误.

该脚本具有以下样式.

/bin/sh
${PODS_ROOT}/Fabric/run API KEY OTHERKEY
Run Code Online (Sandbox Code Playgroud)

我试图在我的Pod的Fabric文件夹中导航,并破坏了这个命令

chmod 755 run
chmod 755 upload-symbols
chmod 755 uploadDSYM
Run Code Online (Sandbox Code Playgroud)

没有运气.任何的想法?

PS

错误如下

/Users/kwstasna/Library/Developer/Xcode/DerivedData/APPNAME-fmbbqrezzwnumzdatywvlcxvqdob/Build/Intermediates/APPNAME.build/Debug-iphoneos/APPNAME.build/Script-6EA07B731D93E6ED00FD0CE8.sh: line 2: /Users/kwstasna/Desktop/open: No such file or directory
Run Code Online (Sandbox Code Playgroud)

xcode ios twitter-fabric xcode8

2
推荐指数
1
解决办法
1万
查看次数

自定义主题在Xcode 8中不再起作用

我有一个我非常喜欢的主题,但它在Xcode 8中不再起作用.任何提示?

我尝试重新启动Xcode并重新安装主题,Xcode/UserData/FontAndColorThemes但没有运气.

xcode8

2
推荐指数
1
解决办法
1701
查看次数

Swift3的许多问题:无法理解完成处理程序的新语法

昨天我更新到新的Mac OS X Sierra和XCode 8,迫使我更新到Swift 3.0语法.在我的应用程序中,我有许多功能,如下所示:

fileprivate func requestFisheFieldWithHandler(_ url:String, completionHandler: @escaping (_ success: NSDictionary?, _ error: NSError?) -> Void) {

    let configuration = URLSessionConfiguration.default

    let url: URL = URL(string: url)!
    let urlRequest: URLRequest = URLRequest(url: url)

    let session = URLSession(configuration: configuration)

    let task = session.dataTask(with: urlRequest, completionHandler: { (data: Foundation.Data?, response: URLResponse?, error: NSError?) -> Void in

        if (error != nil) {
            //print(error?.code)
            //print(error)
            completionHandler(success: nil, error: error)
        }

        else {
            do {
                let responseJSON = try JSONSerialization.jsonObject(with: data!, …
Run Code Online (Sandbox Code Playgroud)

xcode swift swift3 ios10 xcode8

2
推荐指数
1
解决办法
2800
查看次数

当我按Enter键时,xcode自动缩进

在最后一次更新Xcode(版本8.1(8B62))之后,当我按Enter键时,它开始进行自动缩进。在发生这种情况时,我没有为我进行配置,因为我一直在使用krtl + i进行重新缩进。重新缩进使缩进远离最后一行,使我发疯,如何在Xcode中阻止它?

xcode xcode8 xcode8.1

2
推荐指数
1
解决办法
740
查看次数

无法创建Podfile,因为"路径中的plist文件不存在"

运行命令pod init .返回:

[!]路径/Users/admin/Desktop/TestProject/project.pbxproj中的plist文件 不存在.

我正在运行'Test Project'文件夹中的命令.要获取.plist文件:TestProject > TestProject > Info.plist.

我有在我的构建设置中设置的plist文件的路径,如下所示:

在此输入图像描述

我错过了什么?

xcode objective-c ios xcode8

2
推荐指数
1
解决办法
2556
查看次数

使用XCode 8修复iOS 11崩溃

我的应用程序病毒式传播(yay!),并且在启动时为所有运行iOS 11的用户(boo!)发生硬崩溃.但是,当我使用XCode 9 beta(1和2)构建和运行它时,它在模拟器和手机上都能正常工作.

由于XCode 8(产生破坏的版本)无法调试iOS 11设备,并且XCode 9无法复制崩溃,因此似乎没有办法测试潜在的修复,除了将它们放在TestFlight上.即使我这样做,也无法将其连接到XCode 8调试器.有没有更简单的方法在XCode 8上调试iOS 11?谢谢!

(好奇的是,崩溃发生在UITableView._endCellAnimation- 关于__exceptionPreprocess的事情.这是片段:

    let task = ItemSource.sharedSource.getRandomItems(10)
    task.continueWith(
        Executor.mainThread,
        continuation: {
            (task: Task<[Item]>) in
            let nouns: [Item] = task.result!
            self.controller.tableView.beginUpdates()
            var indexPaths = [IndexPath]()
            for noun in nouns {
                indexPaths.append(self.append(noun))
            }
            self.controller.tableView.insertRows(at: indexPaths, with: .none)
            self.controller.tableView.endUpdates() <-- Crashes here
        }
    )
Run Code Online (Sandbox Code Playgroud)

xcode uikit ios xcode8 ios11

2
推荐指数
1
解决办法
985
查看次数

无法将类型UIViewController的值转换为RecordDrawerController

我复制了一个目标和它的架构,我正在尝试运行该项目,但它因任何原因我都不知道失败.

下面我粘贴一个错误的捕获.

在此输入图像描述

对此有何帮助?

谢谢你的建议.

swift xcode8

2
推荐指数
1
解决办法
2485
查看次数

在部分代码中抑制"部分:在iOS中引入"

我的应用程序也适用于iOS9 ...

但是在宣布的时候

- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

我得到警告is partial: introduced in iOS 11.0+,在这种情况下不会出现,因为该方法不会在iOS11之前调用

我想对这部分代码的警告保持沉默

在此输入图像描述

cocoa objective-c ios xcode8

2
推荐指数
1
解决办法
417
查看次数