草庐IT

APPDELEGATE

全部标签

swift - Swift 中的应用程序 openURL

我在使用Appdelegate方法OpenURL时遇到问题。我已经设置了导入的UTI和文档类型。但是,当我从邮件附件中打开我的应用程序时,应用程序会在我实现该方法后立即崩溃。折旧的handleOpenURL有效,但OpenURL无效?目前我在实现中没有代码,只是返回true。funcapplication(application:UIApplication,openURLurl:NSURL,sourceApplication:String,annotation:AnyObject?)->Bool{returntrue}崩溃显示Thread1:EXC_BAD_ACCESS(code-1,

objective-c - Swift 动态转换失败 - 尝试运行单元测试时出错

Xcode版本6.1.1(6A2008a)错误:libswiftCore.dylib`swift_dynamicCastClassUnconditional和Swift动态转换失败我正在尝试测试,但遇到了这个错误,我不确定如何修复。有人可以对此有所了解吗?发生错误:此转换发生错误:vardelegate=UIApplication.sharedApplication().delegateasAppDelegate看完thispost:我从测试目标中删除了AppDelegate.swift,但在构建时出现错误,因为编译器提示不知道转换中的“AppDelegate”。我糊涂了?!

swift - 为什么 "var delegate: UIApplicationDelegate?"在 UIApplication 中成为可选项?那会是 fatal error 吗?

如果delegate属性曾经是nil,应用将处于不可恢复的状态。classUIApplicationDeclarationunowned(unsafe)vardelegate:UIApplicationDelegate?DiscussionEveryappmusthaveanappdelegateobjecttorespondtoapp-relatedmessages.Forexample,theappnotifiesitsdelegatewhentheappfinisheslaunchingandwhenitsforegroundorbackgroundexecutionstatus

ios - 在 AppDelegate 中以编程方式设置 App 入口点

在我的appdelegate中,我想检查是否globUs.hasName。如果是这样,我希望应用程序的EntryPoint成为我的mainStoryboard。如果不是,我希望应用程序的EntryPoint成为我的newUserStoryboard。如何设置应用程序的入口点?如果我不能,实现此功能的最有效方法是什么? 最佳答案 考虑没有入口点。然后,在appDelegate中,测试您的变量并相应地选择合适的Storyboard。然后显示该Storyboard中的ViewController。funcapplication(_appl

ios - 只在 UITableView 中删除一些行 [Swift 3.0 - Xcode 8]

我有一个数组fruit=["Apple","Orange","Pear","Kiwi"]具有实体FOOD并显示在UItableView中。有没有办法让一些内容不可删除。例如,我可以使"Kiwi"不可删除吗?有点像,让i=fruit.index(其中:“猕猴桃”)让IArr=[0...fruit.count]IArr=IArr.filter{$0!=i}//删除Kiwi的索引functableView(_tableView:UITableView,commiteditingStyle:UITableViewCellEditingStyle,forRowAtindexPath:IArr){

ios - 如何使用 Swift 配置后台应用刷新?

我有以下功能可以在我的SeachVC(UIViewController)中下载JSON数据,效果很好。funcdownloadJSON(){guardleturl=URL(string:"myURL")else{return}URLSession.shared.dataTask(with:url){(data,response,err)inguardletdata=dataelse{return}do{letdownloadedCurrencies=tryJSONDecoder().decode([Currency].self,from:data)//Addingdownloadedd

ios - AppDelegate 的 'downcasting' 会失败吗?

在使用CoreData时,我们需要访问可通过AppDelegate访问的共享存储。要获取对AppDelegate的引用,我们可以通过执行以下操作来获取它:guardletappDelegate=UIApplication.shared.delegateas?AppDelegateelse{return}为什么向下转型到Appdelegate时我们必须如此安全?沮丧是否会因为某种原因而失败?如果是,为什么?我环顾四周,找不到我们为什么要写这段代码的原因,想知道我为什么要写这些东西会有帮助! 最佳答案 AppDelegate的可选向下转

ios - UINavigationBar 在 AppDelegate.swift 中设置自定义阴影

我想为整个应用程序的UINavigationBar底部设置一些阴影。这是我尝试过但不起作用的方法:funcapplication(application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[NSObject:AnyObject]?)->Bool{UINavigationBar.appearance().layer.shadowOffset=CGSizeMake(0,3)UINavigationBar.appearance().layer.shadowRadius=3.0UINavigationBar.app

swift 3 : AppDelegate does not conform to protocol GIDSignInDelegate

现在我正在尝试实现Google登录。我是这样跟着的:https://developers.google.com/identity/sign-in/ios/sign-in?ver=swift但我在AppDelegate.swift中遇到错误:classAppDelegate:UIResponder,UIApplicationDelegate,GIDSignInDelegate....错误:Type'AppDelegate'doesnotconformtoprotocol'GIDSignInDelegate'帮帮我。 最佳答案 您需要在

swift - 无法在 iOS8 上设置交互式推送通知

我已经能够设置交互式本地通知,但远程通知不起作用。我正在使用Parse.com发送JSON我的AppDelegate.Swift看起来像这样:////AppDelegate.swift//SwifferApp////CreatedbyTrainingon29/06/14.//Copyright(c)2014Training.Allrightsreserved.//importUIKit@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{varwindow:UIWindow?funcapplicatio