Tag: swift3

AWS Mobilehub:Swift 3更新,在启动选项中显示错误

由于我更新了我使用AWS Mobilehub创build的amazon web服务应用程序swift 3,因此我收到以下错误消息: 只要我用“!” 删除错误我的应用程序崩溃,由于一个致命的错误:

如何快速parsingJson对象3

您好我的问题是关于json对象。 我有这个链接“ http://ip-api.com/json ”,这个链接给出了你的IP地址的详细信息。 我只需要从这个json文件打印IP地址在swift 3.我很新可能是我的问题是基本的,但我需要一些帮助来整理我的项目。 所以我做了如下。 let requestURL: NSURL = NSURL(string: "http://ip-api.com/json")! let urlRequest: NSMutableURLRequest = NSMutableURLRequest(url: requestURL as URL) let session = URLSession.shared let task = session.dataTask(with: urlRequest as URLRequest) { (data, response, error) -> Void in let httpResponse = response as! HTTPURLResponse let statusCode = httpResponse.statusCode if (statusCode == 200) { print("Everyone […]

如何将Google联系人提取到iOS应用程序中

我读了下面的链接,现在我明白,我需要做一个API调用来获取联系人。 因为我是Swift3的新手,有人可以指导我如何做到这一点。 我读了Almofire和Swifty json会帮忙的地方,我也读GData也会帮忙。 我有点困惑。 请指导我 Google通讯录API

转换为Swift 3(Swift和Firebase项目)

我刚刚更新我的Xcode到Xcode8,我已经把项目转换为SWIFT 3。 在这里signIn函数: Firth. Auth()?.signIn(withEmail: self.EmailTF.text!, password: self.PasswordTF.text!, completion: { (user: FIRUser?, error: NSError?) in if let error = error { print(error.localizedDescription) } else { self.ref.child("UserProfile").child(user!.uid).setValue([ "email": self.EmailTF.text!, "name" : self.NameTF.text!, "phone": self.PhoneTF.text!, "city" : self.CityTF.text!, ]) print("Sucess") } }) 我得到这个错误: cannot convert value of type '(FIRUser?, NSError?) -> ()' to expected argument type 'FIRAuthResultCallback?' […]

AVAudioPlayerNode不播放声音

我正在尝试使用下面的代码生成声音。 Everthing罚款没有错误。 但是当我执行这个代码时,没有声音。 我该如何解决这个问题? 顺便说一句,我使用这个例子: http : //www.tmroyal.com/playing-sounds-in-swift-audioengine.html var ae:AVAudioEngine var player:AVAudioPlayerNode? var mixer:AVAudioMixerNode var buffer:AVAudioPCMBuffer ae = AVAudioEngine() player = AVAudioPlayerNode() mixer = ae.mainMixerNode; buffer = AVAudioPCMBuffer(pcmFormat: player!.outputFormat(forBus:0), frameCapacity: 100) buffer.frameLength = 100 // generate sine wave. var sr:Float = Float(mixer.outputFormat(forBus:0).sampleRate) var n_channels = mixer.outputFormat(forBus:0).channelCount var i:Int=0 while i < Int(buffer.frameLength) { var val […]

简单的Webview:navigationDelegate开始崩溃

我的WebView有一个小问题。 这是我在我的应用程序中所做的: import UIKit import WebKit class ViewController: UIViewController, WKNavigationDelegate { @IBOutlet var webView: WKWebView! // draged from storyboard override func viewDidLoad() { super.viewDidLoad() var urlToLoad : (String) urlToLoad = "http://wwww.myapp.com" webView.sizeToFit() webView.isUserInteractionEnabled = true let url = URL(string: urlToLoad) let request = URLRequest(url:url!) //webView.navigationDelegate = self webView.load(request) } 正如你看到的行“webView.navigationDelegate = self”被评论。 如果我取消注释,我的应用程序将在开始时崩溃并告诉我: debugging器 :libc […]

dynamic设置tableview的高度并将其限制在一定范围内swift 3?

我有一个表视图作为popUpTableView,因为我需要设置表视图高度为每行的dynamic。 我正在joincellForRowAtIndexpath popupTableView.height = popupTableView.contentSize.height 它工作正常,但问题是当没有单元格增加,然后桌面高度增加比它的原始高度 extension DiagnosisViewController :UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if tableView == diagnosisTableView { return self.diagnosisModel.count } else if tableView == popupTableView { return self.popupDiagnosisModel.count } return 0 } func tableView(_ tableView: UITableView, cellForRowAt […]

iOS应用程序在发行模式下崩溃,在debugging模式下工作

最近我的应用程序开始打破,如果我创buildAppStore版本的.ipa文件。 它工作正常,如果我在模拟器中运行相同的代码,或者如果我从我的iPhone从Xcode运行它,但一旦我创build发行包,崩溃时,打开一个特定的视图控制器。 我经历了Stackoverflow的几个post,人们有类似的问题,并尝试以下的事情: 设置SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 用于发布模式 设置GCC_OPTIMIZATION_LEVEL = 0; 用于发布模式 评论最近添加的一些UI组件 以下是我从设备上获得的日志: Incident Identifier: 4F30BFF1-71DC-4542-A330-F3786B3302A8 CrashReporter Key: f6fcec71c8263640bd75a0d18937c323d8a95b43 Hardware Model: iPhone8,1 Process: Dummy [633] Path: /private/var/containers/Bundle/Application/370692A3-C880-4008-8C70-641801FB894A/Dummy.app/Dummy Identifier: com.example.Dummy Version: 1.0.71 (1.0.71) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: com.example.Dummy [741] Date/Time: 2017-10-09 18:08:28.2604 -0700 Launch Time: 2017-10-09 18:07:45.3034 -0700 OS […]

无法在tableview Swift中显示核心数据

class showPageViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var tableView: UITableView! var records : [Record] = [] func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return records.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell() return […]

Swift如何获得UIAlertController标题的高度

目前我正在使用UIAlertController在迅速。 我正在尝试向我的警报控制器添加一个活动指示器。 我发现了以下解决scheme,但是当标题大于一行时,微调器和标题重叠。 为此我想,我需要知道标题标签的高度。 let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray) spinner.center = CGPoint(x: 130.5, y: 65.5) spinner.startAnimating() alert.view.addSubview(spinner) 有人请帮助我一个适当的解决scheme。