草庐IT

my_numeric_cast

全部标签

ios - 无法通过在 <My App> 中打开共享表 : no file at the provided file URL exists 从 iOS 文件应用程序打开文件

我的iOS应用程序可以打开CSV文件,以便导入它们的数据。我可以通过UIDocumentPickerViewController从应用程序中打开文件,没有任何问题,选择文件应用程序中显示的文件。但是,当首先在"file"应用程序中查看文件,然后从那里打开我的应用程序(通过“打开方式”共享表)时,我的应用程序无法在传递给我的应用程序的URL上看到该文件。该文件似乎不存在。我将以下调试代码添加到我的AppDelegate中:funcapplication(_app:UIApplication,openurl:URL,options:[UIApplication.OpenURLOptions

ios - cellForRow(在 : indexPath) returns nil and crashes my swift app

在我的swift应用程序中,我在UITableView中显示单元格,前10个单元格包含一张照片。我决定为每个单元格添加视差效果,这样当用户上下滚动表格时-图像会改变它的偏移量。这是我从我的网络服务中获取数据并将其最初添加到TableView的方式:funcmakePostQueryForFetchingData(_parameters:[String:AnyObject],url:String,type:String){Alamofire.request(url,method:.post,parameters:(parameters),encoding:JSONEncoding.def

ios - 使用 Swift 的 Alamofire - "Could not cast value of type ' Swift._SwiftDeferredNSArray' (ox10a75ebb0) 到 'Photomania.PhotoInfo' (0x107ee7b90)。”

运行OSXElCap开发测试版、iOS9.0、Xcode7.0GM我正在关注RayWenderlich教程(http://www.raywenderlich.com/85080/beginning-alamofire-tutorial),但确实遇到了一些问题。在我创建请求路由器之前,我的应用程序无法运行。它构建正确,然后一旦开始加载,我就会在标题中看到调试器短语。构建错误描述为“Thread1:signalSIGABRT”。概述的行是:letimageURL=(photos.objectAtIndex(indexPath.row)as!PhotoInfo).url这是PhotoBrow

php - swift 错误 : Error Domain=NSCocoaErrorDomain Code=3840 "Problems with my Login Controller "

这是我的代码,我无法编译它。我正在尝试登录到我的服务器,但它不允许我这样做抱歉,我是编程新手,我研究过stackoverflow,关于这个错误,我只能解析字典或数组。但我通过复制我的JSON响应进行了搜索,但它不起作用。任何建议都会有帮助!!importUIKitclassLogin:UIViewController{@IBOutletvarUsername:UITextField!@IBOutletvarPassword:UITextField!@IBActionfuncLogin(sender:UIButton){letusername=Username.textletpasswo

ios - 黄色警告 : Conditional cast from UITextDocumentProxy to UIKeyInput always succeeds

我正在使用键盘,我刚刚安装了xcode7beta2然后我收到很多警告。超过24个黄色错误我认为这会使键盘崩溃onxcode6.4无错误无键盘当然我发现很难解决这些错误。警告:ConditionalcastfromUITextDocumentProxytoUIKeyInputalwayssucceedsfunchandleBtnPress(sender:UIButton){ifletkbd=self.keyboard{iflettextDocumentProxy=kbd.textDocumentProxyas?UIKeyInput{textDocumentProxy.insertText

ios - Swift4 单元测试 : ViewController not found when type casting

我目前正在使用以下代码在MyViewController类上编写测试:letviewController=UIStoryboard(name:"Main",bundle:Bundle.main).instantiateViewController(withIdentifier:"MyViewController")XCTAssertNotNil(viewController.view)XCTAssertNotNil(viewControlleras?MyViewController)这个测试不起作用,第二个断言总是失败。当我调试时,我可以看到我的viewController具有正确的类

ios - AVAudioSession : Some Bluetooth devices are not working properly on my App

我正在使用AVAudioSession开发一个快速的音频/视频和文本聊天iOS应用程序。每当我选择使用某些蓝牙设备时,设备上播放的声音不是App音频流。每当发送/接收消息时,它们只播放文本聊天库发送的系统声音。它不会在所有蓝牙设备上发生,在其中一些设备上一切正常。在内置麦克风和扬声器上,该应用程序也能正常工作。以下是我类用于管理设备的最重要的方法:classMyAudioSession{privatevarmAudioSession:AVAudioSession;init!(){self.mAudioSession=AVAudioSession.sharedInstance();do{

casting - 快速子类和类型转换

这是我做的测试:我定义了2个类:classTest1{varp1:String?="p1"init(){println("inittest1")}}classTest2:Test1{init(){super.init()p1="p2"println("inittest2")}}然后我创建一个Test2的实例letx=Test2()我会检查Test2是否是Test2的子类ifxisTest1{println("ok")}else{println("no")}但我有一个构建错误:Test1不是Test2的子类型我哪里错了?我试过了,没有成功,还有这个:iflety=xas?Test1{pr

ios - Swift:PrepareForSegue,Swift Cast 失败

我想在我的TableViewController中选择一个单元格。单元格的文本应该通过segue传输到FirstViewController的标签。我总是收到如下所示的错误。标识符正确。我的代码:overridefuncprepareForSegue(segue:UIStoryboardSegue!,sender:AnyObject!){if(segue.identifier=="BackToCalculator"){//letmyRow=tableView.indexPathForSelectedRow().row+1letvc=segue.destinationViewContro

swift - Xcode 6.3 和 Swift 1.2 中的新警告 : Cast from '[SKNode]' to unrelated type 'String' always fails

更新到xCode6.3/Swift1.2后,我遇到了一个我无法解决的错误:“从‘[SKNode]’转换为不相关的类型‘String’总是失败”。下面是我的GameScene代码,它从解析p-list开始。importSpriteKitclassGameScene:SKScene,SKPhysicsContactDelegate,NSXMLParserDelegate{varcurrentTMXFile:String?overridefuncdidMoveToView(view:SKView){/*Parsep-list*/letpath=NSBundle.mainBundle().pa