加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – 应用程序崩溃登录(xcode 9.3)EXC_BAD_ACCESS(代码= 1,

发布时间:2020-12-14 05:48:01 所属栏目:百科 来源:网络整理
导读:我在9.3更新中遇到此崩溃,在9.2上一切正常.它能是什么?通过任何来源登录时出现错误(登录通行证,VK,谷歌) class AppDelegate: UIResponder,UIApplicationDelegate,GIDSignInDelegate {var window: UIWindow?private let settingsManager = SettingsManager.m
我在9.3更新中遇到此崩溃,在9.2上一切正常.它能是什么?通过任何来源登录时出现错误(登录通行证,VK,谷歌)
class AppDelegate: UIResponder,UIApplicationDelegate,GIDSignInDelegate {

var window: UIWindow?

private let settingsManager = SettingsManager.manager

func application(_ application: UIApplication,didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

//  Googole Map
    GMSServices.provideAPIKey("-k")

    UINavigationBar.appearance().tintColor = #colorLiteral(red: 1,green: 1,blue: 1,alpha: 1)
    UINavigationBar.appearance().barTintColor = #colorLiteral(red: 0.2069905996,green: 0.2386507988,blue: 0.3337202668,alpha: 1)

    UITabBar.appearance().tintColor = #colorLiteral(red: 0.2069905996,alpha: 1)

    let barFont = UIFont.systemFont(ofSize: 20)
    UINavigationBar.appearance().titleTextAttributes =  [NSForegroundColorAttributeName: #colorLiteral(red: 1,alpha: 1),NSFontAttributeName: barFont]


    if settingsManager.isFirstStartApp {

    } else {

        settingsManager.isFirstStartApp = true
        settingsManager.setDefaultSettings()

    }

    // Facebook
    FBSDKApplicationDelegate.sharedInstance().application(application,didFinishLaunchingWithOptions: launchOptions)

    // Google +
    var configureError: NSError?
    GGLContext.sharedInstance().configureWithError(&configureError)
    assert(configureError == nil,"Error configuring Google services: (String(describing: configureError)) )")
    GIDSignIn.sharedInstance().delegate = self

    return true
}

通过谷歌签名时第一个应用程序方法出错.我搜索了一些话题 – 没有运气.转换为Swift 4 – 没有运气.有任何想法吗?

崩溃日志pastebin.com/DEEeQnZB

随着接受的答案,我得到了进一步,但现在它崩溃了

let predicate = NSPredicate(format: "isActive == %@",true as CVarArg)

具有相同的“访问不良”

UPD:通过替换来解决问题

let predicate = NSPredicate(format: "isActive == %@",true as CVarArg)

let predicate = NSPredicate(format: "isActive == true")
与Facebook登录有类似的问题 – 在Xcode 9.3发行说明中找到了我的工作:

https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-DontLinkElementID_1

引用它们

In circumstances where protocol methods or base class methods defined
in Objective-C claim to take non-null arguments of type id in their
headers,but get invoked with nil values at runtime,Swift code
compiled by Xcode 9.3 that overrides those methods may crash when the
Swift implementations are invoked. (38675815) Workaround: Change the
Swift override to take a value of type Any?. For example,if you
implement the UIApplicationDelegate protocol’s
application(_:open:sourceApplication:annotation:) method:

class AppDelegate: UIApplicationDelegate {
func application(_ application: UIApplication,open url: URL,sourceApplication: String?,annotation: Any) -> Bool {
    return true
}

The program may crash when passed nil as the annotation argument.
Avoid the crash by making the annotation argument have type Any?:

class AppDelegate: UIApplicationDelegate {
func application(_ application: UIApplication,annotation: Any?) -> Bool {
    return true
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读