草庐IT

ios - Swift 的 NSCoding 中的 EXC_BAD_INSTRUCTION

funcencodeWithCoder(aCoder:NSCoder!){aCoder.encodeObject(title.bridgeToObjectiveC(),forKey:"title")aCoder.encodeObject(self.artist.bridgeToObjectiveC(),forKey:"artist")}init(coderaDecoder:NSCoder!){NSLog("title:%@",aDecoder.decodeObjectForKey("title")asNSString);//我有一个符合上述NSCoding的NSObject,但是当它初

azure - 在 iOS 上使用带有 swift 的 Azure 移动服务框架的问题 - EXC_BAD_ACCESS 同时将表记录保存到类属性

我无法通过SwiftiOS应用程序使用Azure移动服务。我认为这个问题与对self.items属性的闭包访问有关。我已经尝试从github构建dev分支,但我收到同样的错误。errorEXC_BAD_ACCESS(code=1,address=0xa0)这是我的代码:importUIKitclassAVZItemsTableViewController:UIViewController,UITableViewDataSource,UITableViewDelegate{leturl="https://XYZ.azure-mobile.net/"letkey="XYZ"lettable

inheritance - 在 Swift 中使用泛型、协议(protocol)和继承创建对象时出现 EXC_BAD_ACCESS

此代码会产生EXC_BAD_ACCESS(即使在playground中)。(我简化了我的代码以便更好地理解。)准备://Playground-noun:aplacewherepeoplecanplayprotocolEmptyInit{init();}classFirstBase{}classSecondBase:EmptyInit{requiredinit(){}}classA:FirstBase,EmptyInit{requiredoverrideinit(){}}classB:SecondBase,EmptyInit{requiredinit(){}}很明显,您可以像这样创建A和

swift - 如何调试 "EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)"Swift 错误?

我需要以下代码才能运行。letillinois=College(name:"UniversityodIllinois",location:"Urbana-Champaign",numberOfStudents:35000,image:UIImage(named:"Default")!)letmissouri=College(name:"UniversityofMissouri",location:"Columbia",numberOfStudents:34658,image:UIImage(named:"MissuouriImage")!)letiowa=College(name:"U

iOS11 在 AVPlayerItemTrack.assetTrack.mediaType (Thread 1 : EXC_BAD_ACCESS (code=1, address=0x0) 上崩溃

我像这样从AVPlayerItem观察轨道属性的键值:overridefuncobserveValue(forKeyPathkeyPath:String?,ofobject:Any?,change:[NSKeyValueChangeKey:Any]?,context:UnsafeMutableRawPointer?){ifcontext==&PlayerItemObserverContext{[...morecode...]}elseifkeyPath==#keyPath(AVPlayerItem.tracks){ifletplayerItem=self.playerItem{fort

ios - Swift 中的 UIWebView : exc_bad_access

我的带有UIWebView的Swift应用在尝试获取当前URL时因exc_bad_access而崩溃。它也仅在某些情况下崩溃(通常取决于用户在该UIWebView中执行的操作)。尝试加载代码中提供的url,然后点击取消。如果我不从UIWebViewDelegate协议(protocol)实现方法,它永远不会崩溃。classAuthViewController:UIViewController,UIWebViewDelegate{@IBOutletvarauthWebView:UIWebViewinit(nibNamenibNameOrNil:String?,bundlenibBundl

ios - Swift:将 AppDelegate 实例作为类函数导致线程 1:EXC_BAD_INSTRUCTION

我想从我的AppDelegate中的classfunc获取我的AppDelegate引用。为什么会抛出Thread1:EXC_BAD_INSTRUCTION?classfuncgetDelegate()->AppDelegate{returnUIApplication.sharedApplication().delegateas!AppDelegate}我也曾尝试将其移动到另一个实用程序类并作为常规func,但遇到了同样的崩溃。有没有一种方法可以将AppDelegate作为classfunc而不必编写letappDelegate=UIApplication.sharedApplicat

ios - Swift 中的泛型和 EXC_BAD_ACCESS

我正在使用Swift(XCode6.3.1)开发项目。在运行时我得到EXC_BAD_ACCESS(我在模拟器iPhone6上测试,但是当我使用单元测试类时,我也得到这个错误):这显示了我的代码的结构://FileIPerson.swiftpublicprotocolIPerson{varfirstName:String?{getset}varsecondName:String?{getset}}//FilePersonHelper.swiftpublicclassPersonHelper{publicinit(){}publicfuncdoSomething(person:T)->In

ios - dismissViewControllerAnimated 导致 EXC_BAD_ACCESS - swift

我试图用dismissViewControllerAnimated(true,completion:{})关闭UIViewController,但我在尝试这样做时得到了EXC_BAD_ACCESS。(也就是说,其工作的10次中有1次)。我使用了一个自定义的transitionDelegate,当我不设置它时,它会工作。ListTransitionDelegate返回动画器和presentationController。PresentationController看起来像这样init(presentingViewController:UIViewController!,presented

ios - NSNotificationCenter 导致 SpriteKit 出现 EXC_BAD_ACCESS 错误

我正在使用NSNotificationCenter来尝试控制SpriteKit中的计时器。当我第一次进入SKScene时,代码运行良好,但当我尝试重新进入SKScene时,出现EXC_BAD_ACCESS错误。我认为这与removeObserver函数有关。我不确定何时删除观察者,我尝试在prepareForSegue函数中执行此操作但没有成功。我的ViewController如下:classJobStartedViewController:UIViewController{vartitleOfJob:String=""overridefuncviewDidLoad(){super.v