在Xcode项目上实现第三方库时出错

我正在尝试使用第三方库TTFortuneWheel来构建应用。以下代码是我添加到此新项目中的代码。
当我运行该应用程序时,它显示以下错误:EXC_BAD_accESS(code = 2,address = 0x10e5c8dd8)

class ViewController: UIViewController {


    @IBOutlet weak var spinningWheel: TTFortuneWheel!

    override func viewDidLoad() {
        super.viewDidLoad()

        let slices = [ FortuneWheelSlice(title: "Slice 1"),FortuneWheelSlice(title: "Slice 2"),FortuneWheelSlice(title: "Slice 3")]

        let frame = spinningWheel.frame
        let fortuneWheel = TTFortuneWheel(frame: frame,slices: slices)
        spinningWheel.equalSlices = true
        self.view.addSubview(fortuneWheel)

我还尝试了以下代码,该代码是从TTFortuneWheel的示例修改而来的,并在示例项目上成功运行,但是在我的项目中运行时显示了另一个错误:EXC_BAD_accESS(code = EXC_I386_GPFLT)

 let slices = [ FortuneWheelSlice.init(title: "Roller Coaster"),FortuneWheelSlice.init(title: "Try again"),FortuneWheelSlice.init(title: "Free\nticket"),FortuneWheelSlice.init(title: "Teddy\nbear"),FortuneWheelSlice.init(title: "Large popcorn"),FortuneWheelSlice.init(title: "Balloon figures"),FortuneWheelSlice.init(title: "Ferris Wheel"),FortuneWheelSlice.init(title: "Pony\nRide")]
        spinningWheel.slices = slices
        spinningWheel.equalSlices = true
        spinningWheel.frameStroke.width = 0
        spinningWheel.slices.enumerated().forEach { (pair) in
            let slice = pair.element as! FortuneWheelSlice
            let offset = pair.offset
            switch offset % 4 {
            case 0: slice.style = .dark
            case 1: slice.style = .light
            case 2: slice.style = .dark
            case 3: slice.style = .light
            default: slice.style = .dark
            }
        }

我已经尝试解决这些问题一周了,并通读了TTFortuneWheel的所有文件。如果有人能帮助我解决这些错误或帮助我正确使用TTFortuneWheel,我将不胜感激!

调用堆栈:

0   MyApp                               0x0000000106449cc7 $s13MyApp14ViewControllerC11viewDidLoadyyF + 311
1   MyApp                               0x000000010644a6c4 $s13MyApp14ViewControllerC11viewDidLoadyyFTo + 36
2   UIKitCore                           0x00000001104f343b -[UIViewController loadViewIfRequired] + 1183
3   UIKitCore                           0x00000001104f3868 -[UIViewController view] + 27
4   UIKitCore                           0x0000000110b2bc33 -[UIWindow addRootViewControllerViewIfPossible] + 122
5   UIKitCore                           0x0000000110b2c327 -[UIWindow _setHidden:forced:] + 289
6   UIKitCore                           0x0000000110b3ef86 -[UIWindow makeKeyAndVisible] + 42
7   UIKitCore                           0x0000000110aeef1c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
8   UIKitCore                           0x0000000110af40c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
9   UIKitCore                           0x00000001103396d6 __111-[__UICanvasLifecyclemonitor_Compatability _scheduleFirstCommitForScene:transition:firstactivation:completion:]_block_invoke + 904
10  UIKitCore                           0x0000000110341fce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
11  UIKitCore                           0x00000001103392ec -[__UICanvasLifecyclemonitor_Compatability _scheduleFirstCommitForScene:transition:firstactivation:completion:] + 236
12  UIKitCore                           0x0000000110339c48 -[__UICanvasLifecyclemonitor_Compatability activateEventsonly:withContext:completion:] + 1091
13  UIKitCore                           0x0000000110337fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
14  UIKitCore                           0x0000000110337c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
15  UIKitCore                           0x000000011033c9b6 __125-[_UICanvasLifecycleSettingsDiffaction performactionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
16  UIKitCore                           0x000000011033d610 _performactionsWithDelayForTransitionContext + 100
17  UIKitCore                           0x000000011033c71d -[_UICanvasLifecycleSettingsDiffaction performactionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
18  UIKitCore                           0x00000001103416d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
19  UIKitCore                           0x0000000110af29a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
20  UIKitCore                           0x00000001106a9dfa -[UIApplicationSceneclientAgent scene:didInitializeWithEvent:completion:] + 361
21  FrontBoardServices                  0x0000000113934125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
22  FrontBoardServices                  0x000000011393ded6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
23  FrontBoardServices                  0x000000011393d700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
24  libdispatch.dylib                   0x000000010a5c4db5 _dispatch_client_callout + 8
25  libdispatch.dylib                   0x000000010a5c82ba _dispatch_block_invoke_direct + 300
26  FrontBoardServices                  0x000000011396f146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
27  FrontBoardServices                  0x000000011396edfe -[FBSSerialQueue _performNext] + 451
28  FrontBoardServices                  0x000000011396f393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
29  CoreFoundation                      0x0000000109198be1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30  CoreFoundation                      0x0000000109198463 __CFRunLoopDoSources0 + 243
31  CoreFoundation                      0x0000000109192b1f __CFRunLoopRun + 1231
32  CoreFoundation                      0x0000000109192302 CFRunLoopRunSpecific + 626
33  GraphicsServices                    0x000000010cff52fe GSEventRunmodal + 65
34  UIKitCore                           0x0000000110af5ba2 UIApplicationmain + 140
35  MyApp                               0x000000010644b77b main + 75
36  libdyld.dylib                       0x000000010a639541 start + 1
37  ???                          
kigoor_3 回答:在Xcode项目上实现第三方库时出错

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3130204.html

大家都在问