草庐IT

Uiapplication

全部标签

ios - UIApplication.delegate 只能在主线程中使用

这个问题在这里已经有了答案:-[UIApplicationdelegate]mustbecalledfrommainthreadonly(2个答案)关闭5年前。我的应用程序委托(delegate)中有以下代码作为在我的其他viewController中使用CoreData的快捷方式:letad=UIApplication.shared.delegateas!AppDelegateletcontext=ad.persistentContainer.viewContext但是,我现在收到错误消息:"UIAPIcalledfrombackgroundthread"and"UIApplicat

ios - 在 Swift 中注册远程通知时未收到设备 token

我在注册远程通知时无法收到设备token。我得到模态说“你想让AppX能够向你发送通知”,但是当我接受它时,没有调用didRegisterForRemoteNotifications函数。当我使用此代码在iOS8/Swift中注册远程通知时:UIApplication.sharedApplication().registerForRemoteNotifications()letsettings=UIUserNotificationSettings(forTypes:UIUserNotificationType.Badge|UIUserNotificationType.Alert|UIU

ios - 在 Swift 中注册远程通知时未收到设备 token

我在注册远程通知时无法收到设备token。我得到模态说“你想让AppX能够向你发送通知”,但是当我接受它时,没有调用didRegisterForRemoteNotifications函数。当我使用此代码在iOS8/Swift中注册远程通知时:UIApplication.sharedApplication().registerForRemoteNotifications()letsettings=UIUserNotificationSettings(forTypes:UIUserNotificationType.Badge|UIUserNotificationType.Alert|UIU

swift - 如何以编程方式打开设置应用程序?

我在ios8.3上使用swift。我想从我的应用程序中打开设置应用程序。我知道使用代码UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!)将打开我的应用程序设置。但我不想打开我的应用程序设置。我只想打开设置应用程序并留在主页面上。如果可能,请导航至“蜂窝”。有什么办法可以实现吗? 最佳答案 试试这个。ifletappSettings=URL(string:UIApplication.openSettin

swift - 如何以编程方式打开设置应用程序?

我在ios8.3上使用swift。我想从我的应用程序中打开设置应用程序。我知道使用代码UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!)将打开我的应用程序设置。但我不想打开我的应用程序设置。我只想打开设置应用程序并留在主页面上。如果可能,请导航至“蜂窝”。有什么办法可以实现吗? 最佳答案 试试这个。ifletappSettings=URL(string:UIApplication.openSettin

ios - Firebase (FCM) 无法获取 APNS token 错误域=com.firebase.iid 代码=1001

我正在尝试使用FCM进行通知。但是无法获取APNStoken错误Domain=com.firebase.iidCode=1001"(null)"发生所以我无法收到通知。有什么问题?在控制台,无法获取APNStokenErrorDomain=com.firebase.iidCode=1001"(null)"下面是我在Appdelegate上的代码importUIKitimportCoreDataimportAlamofireimportFirebaseimportFirebaseInstanceIDimportFirebaseMessaging@UIApplicationMainclas

ios - Firebase (FCM) 无法获取 APNS token 错误域=com.firebase.iid 代码=1001

我正在尝试使用FCM进行通知。但是无法获取APNStoken错误Domain=com.firebase.iidCode=1001"(null)"发生所以我无法收到通知。有什么问题?在控制台,无法获取APNStokenErrorDomain=com.firebase.iidCode=1001"(null)"下面是我在Appdelegate上的代码importUIKitimportCoreDataimportAlamofireimportFirebaseimportFirebaseInstanceIDimportFirebaseMessaging@UIApplicationMainclas

ios - Swift 项目因线程 1 : EXC_BAD_ACCESS (code = 1, 地址 = 0x0 而崩溃)

这看起来像是一个糟糕的内存访问,就像试图访问一个不存在的对象。我尝试使用NSZombie来查看是否出现了问题,据我所知没有任何问题。它在应用程序委托(delegate)声明时崩溃。AppDelegate.swift@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{varwindow:UIWindow?funcapplication(application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[NSObject:AnyObj

ios - Swift 项目因线程 1 : EXC_BAD_ACCESS (code = 1, 地址 = 0x0 而崩溃)

这看起来像是一个糟糕的内存访问,就像试图访问一个不存在的对象。我尝试使用NSZombie来查看是否出现了问题,据我所知没有任何问题。它在应用程序委托(delegate)声明时崩溃。AppDelegate.swift@UIApplicationMainclassAppDelegate:UIResponder,UIApplicationDelegate{varwindow:UIWindow?funcapplication(application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[NSObject:AnyObj

ios - Swift - 在应用程序中打开网页,按钮没有反应

我创建了一个按钮来从应用中调用电话:@IBActionfunccallButton(sender:AnyObject){if(PhoneNumber!=""){UIApplication.sharedApplication().openURL(NSURL(string:"telprompt://\(PhoneNumber)")!)}}而且它工作得很好。当我想打开网页时会发生奇怪的事情。我使用几乎完全相同的代码@IBActionfuncopenWeb(sender:AnyObject){UIApplication.sharedApplication().openURL(NSURL(str