标签: xcode8

getBytes方法的Swift 3更改

我试图在swift 3中运行以下代码

 var values = [UInt8](count:data!.length, repeatedValue:0)
 data!.getBytes(&values, length:data!.length)
Run Code Online (Sandbox Code Playgroud)

其中数据是'数据'数据类型(NSData根据swift 3指南更改为'数据')

我无法在Swift 3中运行上面的代码.编译器给出了"Argument Repeated value必须在参数之前"的错误.同样的代码行在Swift 2.2中运行

解决方案是什么?

ios swift3 xcode8

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

Xcode 8拖动并连接@IBAction错误地在连接检查器IB上添加"WithSender"

Xcode 8拖动并连接@IBAction错误地在连接检查器IB上添加"WithSender"

因此,我必须将方法重命名为类似的方法

@IBAction func tappedConfirmButtonWithSender(sender:AnyObject){}

不应该吗?:

@IBAction func tappedConfirmButton(sender:AnyObject){}

这是我的错还是这个错误?

ibaction xcode8

15
推荐指数
1
解决办法
4726
查看次数

Swift 3,Xcode 8实例化View Controller无法正常工作

编译时的Xcode 8表示viewcontroller用标识符简单地更改实例化,实例化视图控制器.我这样做了,为什么会出现两个错误?

我正在使用Swift 3.我想以编程方式更改页面.我已经阅读了很多关于该主题的其他问题.所有这些都使用带有标识符的实例化视图控制器.他们没有采用新语言.

@IBAction func switchPage(_ sender: UIButton) {

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let viewController = 
storyboard.instantiateViewController("secondViewController") as! 
UIViewController
    self.presentViewController(secondViewController, animated: true, 
completion: nil)    

}
Run Code Online (Sandbox Code Playgroud)

谢谢.我按照建议改变了代码,只收到一个错误:可选类型'UIStoryboard?'的值 没有打开; 你的意思是用'!' 要么 '?'?我应该在某处添加感叹号吗?

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a 
nib.
}

@IBAction func ch(_ sender: UIButton) {



    let viewController = 
storyboard.instantiateViewController(withIdentifier: 
"secondViewController") as! UIViewController
    self.present(viewController, animated: true)



}




override func …
Run Code Online (Sandbox Code Playgroud)

storyboard viewcontroller swift swift3 xcode8

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

使用Cordova和XCode 8,如何使用推送通知功能运行iOS版本?

我正在使用Ionic/Cordova构建Android和iOS应用程序.在部署之前,我使用Jenkins运行'ionic build ios --device'来创建最终的IPA文件以供QA测试.不幸的是,使用xCode 8,您现在必须在XCode项目功能设置中手动启用推送通知功能.

有没有办法将功能传递给ionic buildcordova build通过CLI构建时启用推送通知?

cordova ionic-framework xcode8

15
推荐指数
1
解决办法
876
查看次数

像Uber iOS应用程序一样在地图上移动注释

我正在开发一个项目,我需要为UBER和OLA创建类似的iOS应用程序,其中汽车根据位置移动.我正在寻找某种类型的图书馆,它可以让汽车像OLA一样顺畅地转动.现在我能够将汽车从一个纬度经度移动到另一个纬度经度.但复杂的部分是如何转向并确保汽车在朝向方向时面向前方.

请查看以下屏幕截图.

截图

objective-c latitude-longitude mkmapview mkannotation xcode8

15
推荐指数
1
解决办法
6401
查看次数

如果没有它可以防止一堆dylib警告,就无法运行Swift REPL

我刚刚安装了Xcode 8.2并尝试运行Swift REPL.我遇到了以下警告.我该如何解决?请注意,这是与Sierra的全新MBP.Xcode是目前除标准集外安装的极少数应用程序之一.

Welcome to Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1). Type :help for assistance.
warning: Swift error in module repl_swift.
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module dyld.
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module libz.1.dylib.
Debug info from this module will be unavailable in the debugger.

warning: Swift error in module libedit.3.dylib.
Debug info from this module will be unavailable …
Run Code Online (Sandbox Code Playgroud)

read-eval-print-loop swift xcode8

15
推荐指数
1
解决办法
1784
查看次数

在XCode中键入时,当前行文本字体大小会增加

当我在工作区中的特定行上键入时,特定行的字体中的文本正在增加!一旦我停止打字,它就会达到常规尺寸.

我也升级到XCode 8.2仍然出现同样的问题.

仅供参考:我还尝试了以下代码来重置XCode默认设置,但仍然没有用.

默认删除com.apple.dt.Xcode

xcode xcode8

15
推荐指数
2
解决办法
515
查看次数

无法更新到Xcode 8

我想更新到Xcode 8,但是当我启动App Store时它只显示一个Open按钮,但我现有的版本是7.3.1

要求应该是El Capitan 10.11.5 - 我安装了10.11.6.

为什么没有Update按钮?

在此输入图像描述

xcode xcode8

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

忽略使用"warn_unused_result"属性声明的函数的返回值

我们becomeFirstResponder在Objective-C代码中的所有函数调用上开始发出此警告.

忽略使用"warn_unused_result"属性声明的函数的返回值

[self.phoneNumberField becomeFirstResponder]; // warning here!!!
Run Code Online (Sandbox Code Playgroud)

在这里抑制此警告的最佳方法是什么?


编辑:我也试过这个,

BOOL ignore = [self.emailField becomeFirstResponder]; 
Run Code Online (Sandbox Code Playgroud)

但有了这个,Xcode警告有关变量ignore没有使用:(


我也尝试过这个,

BOOL ignore = [self.phoneNumberField becomeFirstResponder];
if (ignore) {

}
Run Code Online (Sandbox Code Playgroud)

在这种情况下,警告消失了.但我认为我甚至无法通过自己的代码审查.太难看了!

objective-c xcode8

14
推荐指数
2
解决办法
8467
查看次数

为提供程序创建MZContentProviderUpload时发生异常.(1004)

我尝试使用Xcode上传应用程序构建但我得到了这个错误"没有帐户与itunes连接访问"然后我尝试使用应用程序加载器上传IPA并且我收到此错误"为提供程序创建MZContentProviderUpload时发生异常.(1004)"

xcode ios xcode8

14
推荐指数
2
解决办法
4881
查看次数