gpt4 book ai didi

ios - 应用程序在使用 NewRelic 框架的设备上启动时崩溃

转载 作者:行者123 更新时间:2023-11-28 21:40:29 25 4
gpt4 key购买 nike

我有基于 NewRelicAgent.framework 集成的基于 swift 的应用程序...

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Register the analytics app
NewRelicAgent.startWithApplicationToken("AA****************************6");

应用程序在 LoginViewController 上崩溃,启动时第一个 View Controller ,日志如下 -

0   libsystem_c.dylib               0x00000001978d1690 __sfvwrite + 0
1 libsystem_c.dylib 0x00000001978d8958 __vfprintf + 11352
2 libsystem_c.dylib 0x00000001978f367c __v2printf + 584
3 libsystem_c.dylib 0x0000000197886208 _vsnprintf + 300
4 libsystem_c.dylib 0x0000000197886c54 snprintf_l + 20
5 CoreFoundation 0x00000001859d7018 __CFStringAppendFormatCore + 11580
6 CoreFoundation 0x00000001859d42a0 _CFStringCreateWithFormatAndArgumentsAux2 + 244
7 Foundation 0x000000018681a444 -[NSPlaceholderString initWithFormat:locale:arguments:] + 168
8 Foundation 0x000000018681a304 +[NSString stringWithFormat:] + 72
9 Zimplifi 0x00000001001558e0 +[NRMAThreadLocalStore currentThreadDictionary] (NRMAThreadLocalStore.m:238)
10 Zimplifi 0x00000001001540b8 +[NRMAThreadLocalStore threadLocalTrace] (NRMAThreadLocalStore.m:36)
11 Zimplifi 0x0000000100154a80 +[NRMAThreadLocalStore prepareSameThread:child:withParent:] (NRMAThreadLocalStore.m:126)
12 Zimplifi 0x0000000100154500 +[NRMAThreadLocalStore pushChild:forParent:] (NRMAThreadLocalStore.m:91)
13 Zimplifi 0x0000000100123768 +[NRMATraceController newTraceSetup:parentTrace:] (NRMATraceController.m:310)
14 Zimplifi 0x0000000100123c6c +[NRMATraceController enterMethod:fromObject:parentTrace:traceCategory:withTimer:] (NRMATraceController.m:374)
15 Zimplifi 0x0000000100123a40 +[NRMATraceController enterMethod:fromObject:parentTrace:traceCategory:] (NRMATraceController.m:338)
16 Zimplifi 0x000000010010e92c NRMA__beginMethod (NRMAMethodProfiler.m:1051)
17 Zimplifi 0x000000010010e500 NRMA__voidParamHandler (NRMAMethodProfiler.m:705)
18 Zimplifi 0x00000001000677c4 Zimplifi.ZViewController.viewDidLoad (Zimplifi.ZViewController)() -> () (ZViewController.swift:14)
19 Zimplifi 0x0000000100053d1c @objc Zimplifi.LoginViewController.viewDidLoad (Zimplifi.LoginViewController)() -> () (LoginViewController.swift:27)

LoginViewController 是普通 ZViewController 的子类....

class ZViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

}
}

class LoginViewController: ZViewController {
...
...
}

我的任何 View Controller 或项目中都没有与 NewRelicAgent 相关的任何其他代码(项目目标中的 RunScript 除外)。

有解决办法吗?

编辑:使用 FIX :)

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Register the analytics app
NewRelicAgent.enableFeatures(NRMAFeatureFlags.NRFeatureFlag_SwiftInteractionTracing);
NewRelicAgent.startWithApplicationToken("AA****************************6");

// Your app specific code.......

}

// Add 'dynamic' before viewDidLoad method and probably any other view life cycle method or method to be traced for analytics
class ZViewController: UIViewController {

override dynamic func viewDidLoad() {
super.viewDidLoad()
// Your implementation...
}
}

最佳答案

Swift 应用程序需要在 New Relic 中进行一些额外的配置:

https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/getting-started/enabling-swift-interaction-traces

您是否已将 dynamic 声明修饰符添加到您的方法并使用功能标志启用 Swift Interaction 跟踪?

关于ios - 应用程序在使用 NewRelic 框架的设备上启动时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32290745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com