草庐IT

Task_disconnected_while_still_run

全部标签

ios - CLLocationManager fatal error : unexpectedly found nil while unwrapping an Optional value Swift

我有一个问题,因为当我尝试获取位置用户并在我的.plist中获得权限时,我的应用程序崩溃了,这是我的代码。importUIKitimportMapKitimportCoreLocationclassmapClass:UIViewController,MKMapViewDelegate,CLLocationManagerDelegate{varlocation4=CLLocation()varlm=CLLocationManager()@IBOutletvarpropMapa:MKMapView!lm.delegate=selflm.desiredAccuracy=kCLLocation

ios - Swift 通用变量 fatal error : unexpectedly found nil while unwrapping an Optional value

我正在尝试实现一个简单的通用方法:funcfindMax(numbers_array:[T])->(min_tuple:T,max_tuple:T){varmax_number:T?varmin_number:T?foriinnumbers_array{if(max_numberi){min_number=i}}return(min_number!,max_number!)}我正在尝试访问这样的方法:letresult=findMax([3.4,5,-7,-7.8])但是每当我运行这段代码时,我都会收到以下错误:fatalerror:unexpectedlyfoundnilwhileu

swift - fatal error : unexpectedly found nil while unwrapping an Optional value when using AudioPlayer in Swift 2

您好,我正在尝试在swift2中使用以下代码播放音乐文件。基本上我只是将名为f.mp3的音频文件拖到asses文件夹中,我的代码中断并显示以下消息:在展开一个Optional值时意外地发现nil。我需要将mp3文件放在哪里,以便IOS可以找到它。谢谢varaudioPlayer:AVAudioPlayer!=nilfuncplayMyFile(){letpath=NSBundle.mainBundle().pathForResource("f",ofType:"mp3")letfileURL=NSURL(fileURLWithPath:path)do{tryaudioPlayer=AV

ios - xcodebuild no such module 'SwiftyJSON' while build in xcode works

在我的项目中,我使用的是CocoaPods,podfile如下所示:defshared_podsuse_frameworks!pod'SwiftyJSON','~>3.1.4'pod'Alamofire','~>4.3.0'pod'PromiseKit','~>4.4'endtarget'myop'doshared_podsend通过xcode构建工作正常,但如果我尝试通过命令行(xcodebuild工具)构建,我会收到以下错误:error:nosuchmodule'SwiftyJSON'importSwiftyJSON我尝试重新安装SwiftyJSON并将其升级到新版本。还尝试手动将

xcode - AVAudioSession 音频调光错误 : Deactivating an audio session that has running I/O

我正在播放几种声音,每种声音都会使背景音频变暗。完成后,我恢复背景音频。每次播放其中一个音频文件时,背景都会变暗(根据需要)。当最后一个音频完成播放时,背景音频将恢复(也是需要的)。但是大约5秒后,它会抛出此错误并再次调暗音频(这不是我想要的,因为所有声音现在都已结束)。ERROR:[0x19c9af310]AVAudioSession.mm:646:-[AVAudioSessionsetActive:withOptions:error:]:DeactivatinganaudiosessionthathasrunningI/O.AllI/Oshouldbestoppedorpaused

iOS,如何连续动画一行 "running"("marching ants"效果)?

我必须承认我不知道如何在iOS中执行此操作-下面是一些制作漂亮虚线的代码:现在,我希望这条线向上“运行”:因此,每隔一秒它就会向上移动itemLength*2.0。当然,它会从上到下环绕。因此,DottedVertical应该完全独立完成此操作。真的,你如何在iOS中做到这一点?如果解决方案是通用的并且会“滚动”任何我认为的层或绘制的东西,那就太好了。在游戏引擎中,它很简单,您只需为纹理的偏移设置动画。您能否在iOS中偏移图层或其他内容?什么是最好的方法?我猜你会想要使用GPU(图层动画对吗?)以避免融化cpu。@IBDesignableclassDottedVertical:UIVi

iOS 8 核心数据堆栈 - fatal error : found nil while unwrapping an Optional value

我是iOS开发的新手,因此决定实现我自己的核心数据堆栈,以取代Apple的默认堆栈。我不得不对我的代码进行更改(很明显)并且已经能够弄清楚,但是在这种情况下我不能。这是我的代码:importUIKitimportCoreDataclassAddTableViewController:UITableViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate{@IBOutletweakvarnameTextField:UITextField!@IBOutletweakvarlocationTex

ios - 无法使脚本 'run-sonar-swift' 工作

我正在尝试快速运行Sonar。我已经有了带插件的sonarQube,我可以使用这个url在本地访问它http://localhost:9000.我已经安装了您可以在这里找到的所有先决条件:https://github.com/Backelite/sonar-swift但是当我启动run-sonar-swift.sh时,我不知道这个错误是什么。如果有人能给我带来光明,我将不胜感激。这是我在终端命令./run-sonar-swift.sh-v中运行时的日志:MacBook-Air:streamus-phoenix-iosoboujaouane$./run-sonar-swift.sh-vR

Swift SpriteKit : png image appears black while the game is being run. 我该如何解决这个问题?

我正在使用Xcode、Swift和SpriteKit制作游戏。我在photoshop中制作了一张涉及透明度的png图片,在游戏中显示为纯黑色。我还有其他png图像,它们也涉及透明度,它们以预期的方式出现。我不认为这是代码问题,但为了以防万一,这里是将图像引入游戏的代码(它在didMoveToView函数内):letwarning=SKSpriteNode(imageNamed:"yellow_warning")warning.setScale(0.1)warning.anchorPoint=CGPoint(x:0,y:0.5)warning.position=CGPoint(x:CGR

swift - 获取 clang : error: linker command failed with exit code 1 (use -v to see invocation) while google signing

我在不使用cocoapods的情况下链接Google登录时遇到此错误。我在这里提到了很多解决方案,但没有一个解决了我的问题。请指导我找到合适的解决方案。Undefinedsymbolsforarchitecturex86_64:"_GSDK_NSClassFromString",referencedfrom:l010inGoogleSignIn(GIDSignIn.o)l059inGoogleSignIn(GIDSignIn.o)"_OBJC_CLASS_$_GSDK_GTMOAuth2Authentication",referencedfrom:objc-class-refinGoo