【问题标题】:XCode Crash Report (Already Symbolicated) Missing Line NumbersXCode 崩溃报告(已符号化)缺少行号
【发布时间】:2018-01-05 20:54:36
【问题描述】:

我有一个崩溃报告(至少我希望它已经被象征性化了,因为我从 XCode Organizer 获得了这个日志)

Incident Identifier: F4324555-0916-4E32-82EF-3272917367BB
Beta Identifier:     80811904-A512-48A1-9593-D386703A62F0
Hardware Model:      iPhone7,2
Process:             SelfieSuperStarz [596]
Path:                /private/var/containers/Bundle/Application/BFA0D82B-274B-400B-8F84-52A1D7369C51/SelfieSuperStarz.app/SelfieSuperStarz
Identifier:          com.PuckerUp.PuckerUp
Version:             21 (1.31)
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.PuckerUp.PuckerUp [434]


Date/Time:           2017-07-29 20:06:11.7394 -0400
Launch Time:         2017-07-29 19:34:39.7433 -0400
OS Version:          iPhone OS 10.3.2 (14F89)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x18bebafe0 __exceptionPreprocess + 124 (NSException.m:165)
1   libobjc.A.dylib                 0x18a91c538 objc_exception_throw + 56 (objc-exception.mm:521)
2   CoreFoundation                  0x18be26eb4 -[__NSArray0 objectAtIndex:] + 108 (CFArray.c:69)
3   SelfieSuperStarz                0x10007b708 specialized _ArrayBuffer._getElementSlowPath(Int) -> AnyObject + 116
4   SelfieSuperStarz                0x10007ea40 specialized Merger.merge(completion : () -> (), assets : [Asset]) -> () + 1444 (Merger.swift:0)
5   SelfieSuperStarz                0x100071f3c specialized AssetView.finish(UIButton) -> () + 520 (Merger.swift:0)
6   SelfieSuperStarz                0x1000712d0 @objc AssetView.finish(UIButton) -> () + 40 (AssetView.swift:0)
7   UIKit                           0x192021010 -[UIApplication sendAction:to:from:forEvent:] + 96 (UIApplication.m:4580)
8   UIKit                           0x192020f90 -[UIControl sendAction:to:forEvent:] + 80 (UIControl.m:609)
9   UIKit                           0x19200b504 -[UIControl _sendActionsForEvents:withEvent:] + 440 (UIControl.m:694)
10  UIKit                           0x192020874 -[UIControl touchesEnded:withEvent:] + 576 (UIControl.m:446)
11  UIKit                           0x192020390 -[UIWindow _sendTouchesForEvent:] + 2480 (UIWindow.m:2122)
12  UIKit                           0x19201b728 -[UIWindow sendEvent:] + 3192 (UIWindow.m:2292)
13  UIKit                           0x191fec33c -[UIApplication sendEvent:] + 340 (UIApplication.m:10778)
14  UIKit                           0x1927e6014 __dispatchPreprocessedEventFromEventQueue + 2400 (UIEventDispatcher.m:1448)
15  UIKit                           0x1927e0770 __handleEventQueue + 4268 (UIEventDispatcher.m:1671)
16  UIKit                           0x1927e0b9c __handleHIDEventFetcherDrain + 148 (UIEventDispatcher.m:1706)
17  CoreFoundation                  0x18be6942c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1943)
18  CoreFoundation                  0x18be68d9c __CFRunLoopDoSources0 + 540 (CFRunLoop.c:1989)
19  CoreFoundation                  0x18be669a8 __CFRunLoopRun + 744 (CFRunLoop.c:2821)
20  CoreFoundation                  0x18bd96da4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
21  GraphicsServices                0x18d800074 GSEventRunModal + 100 (GSEvent.c:2245)
22  UIKit                           0x192051058 UIApplicationMain + 208 (UIApplication.m:4089)
23  SelfieSuperStarz                0x10002e990 main + 56 (AppDelegate.swift:16)
24  libdyld.dylib                   0x18ada559c start + 4

正如您在我的第 0 行的 Class Merger 中看到的那样。这是不可能的,您可能会假设。我不知道如何解释专门的意思或为什么@objc 在那里。

3   SelfieSuperStarz                0x10007b708 specialized _ArrayBuffer._getElementSlowPath(Int) -> AnyObject + 116
4   SelfieSuperStarz                0x10007ea40 specialized Merger.merge(completion : () -> (), assets : [Asset]) -> () + 1444 (Merger.swift:0)
5   SelfieSuperStarz                0x100071f3c specialized AssetView.finish(UIButton) -> () + 520 (Merger.swift:0)
6   SelfieSuperStarz                0x1000712d0 @objc AssetView.finish(UIButton) -> () + 40 (AssetView.swift:0)

只是不确定错误发生在哪里,因为行说 Merger:0 并且我不确定这些标头(专用/objc)是否在告诉我什么意思。

这是我在 Merger 中的合并函数。我使用各种循环和计算来计算不透明度并确定事物,但我会检查位置是否为零。

func merge(completion:@escaping () -> Void, assets:[Asset]) {

    self.setupAI()

    let assets = assets.sorted(by: { $0.layer.zPosition < $1.layer.zPosition })
    if let firstAsset = controller.firstAsset {

        let mixComposition = AVMutableComposition()

        let firstTrack = mixComposition.addMutableTrack(withMediaType: AVMediaTypeVideo,
                                                                     preferredTrackID: Int32(kCMPersistentTrackID_Invalid))

        do {
            try firstTrack.insertTimeRange(CMTimeRangeMake(kCMTimeZero, self.controller.realDuration),
                                           of: firstAsset.tracks(withMediaType: AVMediaTypeVideo)[0],
                                           at: kCMTimeZero)
        } catch _ {
            print("Failed to load first track")
        }

        let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]

        var myTracks:[AVMutableCompositionTrack] = []
        var ranges:[ClosedRange<CMTime>] = []

        for asset in assets {

            let secondTrack = mixComposition.addMutableTrack(withMediaType: AVMediaTypeVideo,
                                                                          preferredTrackID: Int32(kCMPersistentTrackID_Invalid))
            secondTrack.preferredTransform = asset.asset.preferredTransform
            do {
                try secondTrack.insertTimeRange(CMTimeRangeMake(kCMTimeZero, asset.endTime-asset.beginTime),
                                               of: asset.asset.tracks(withMediaType: AVMediaTypeVideo)[0],
                                               at: CMTime(seconds: CMTimeGetSeconds(asset.beginTime), preferredTimescale: 600000))
            } catch _ {
                print("Failed to load second track")
            }
            if(ranges.count == 0) {
                ranges.append(asset.beginTime...asset.endTime)
            }
            else {
                var none = true
                for range in ranges {
                    let start = range.contains(asset.beginTime)
                    let end = range.contains(asset.endTime)
                    var connection = false
                    var nothing = false

                    //This range is completely encompassed (begin and end inside)
                    if(start && end) {
                        //Don't add to the rnge
                        none = false
                        nothing = true
                    }

                    //Begin is in range (right side)
                    else if(start && !end) {
                        connection = true
                        none = false
                    }

                    //End is in range (left side)
                    else if(!start && end) {
                        connection = true
                        none = false
                    }

                    var connected = false
                    //It connects 2 different timess
                    if(connection) {
                        for range2 in ranges {
                            if(range != range2) {
                                if(start && range2.contains(asset.endTime)) {
                                    let index = ranges.index(of: range)
                                    if(index != nil) {
                                        ranges.remove(at: index!)
                                        ranges.append(range.lowerBound...range2.upperBound)
                                        connected = true
                                        break
                                    }
                                }
                                else if(end && range2.contains(asset.beginTime)) {
                                    let index = ranges.index(of: range)
                                    if(index != nil) {
                                        ranges.remove(at: index!)
                                        ranges.append(range.lowerBound...range2.upperBound)
                                        connected = true
                                        break
                                    }
                                }
                            }
                        }
                    }
                    if(!connected && !none && !nothing) {
                        if(start) {
                            let index = ranges.index(of: range)
                            if(index != nil) {
                                ranges.remove(at: index!)
                                ranges.append(range.lowerBound...asset.endTime)
                            }
                        }
                        else if(end) {
                            let index = ranges.index(of: range)
                            if(index != nil) {
                                ranges.remove(at: index!)
                                ranges.append(asset.beginTime...asset.endTime)
                            }
                        }
                    }
                }
                if(none) {
                    ranges.append(asset.beginTime...asset.endTime)
                }
            }
            myTracks.append(secondTrack)
        }

        for range in ranges {
            print(CMTimeGetSeconds(range.lowerBound), CMTimeGetSeconds(range.upperBound))
        }
        for assets in self.controller.assets {
            print(CMTimeGetSeconds(assets.beginTime), CMTimeGetSeconds(assets.endTime))
        }

        if let loadedAudioAsset = self.controller.audioAsset {
            let audioTrack = mixComposition.addMutableTrack(withMediaType: AVMediaTypeAudio, preferredTrackID: 0)
            do {
                try audioTrack.insertTimeRange(CMTimeRangeMake(kCMTimeZero, self.controller.realDuration),
                                               of: loadedAudioAsset.tracks(withMediaType: AVMediaTypeAudio)[0] ,
                                               at: kCMTimeZero)
            } catch _ {
                print("Failed to load Audio track")
            }
        }

        let mainInstruction = AVMutableVideoCompositionInstruction()
        mainInstruction.timeRange = CMTimeRangeMake(kCMTimeZero, self.controller.realDuration)

        // 2.2
        let firstInstruction = self.videoCompositionInstructionForTrack(firstTrack, firstAsset)
        var instructions:[AVMutableVideoCompositionLayerInstruction] = []
        var counter:Int = 0
        for tracks in myTracks {
            let secondInstruction = self.videoCompositionInstructionForTrack(tracks, assets[counter].asset, type:true)
            let index = myTracks.index(of: tracks)

            //This should never be nil, but if it is, it might cause opacity's to go out of whack for that specific track. Only reason I can think of why I am crashing in this method.
            if(index != nil) {
                if(index! < assets.count-1) {
                    for i in (counter+1...assets.count-1) {
                        if(assets[counter].endTime > assets[i].endTime) {
                            secondInstruction.setOpacity(1.0, at: assets[i].endTime)
                            secondInstruction.setOpacity(0.0, at: assets[counter].endTime)
                            print("Bigger")
                            break
                        }
                    }
                }
                if(index! > 0) {
                    for i in (0...counter).reversed() {
                        if(assets[counter].endTime < assets[i].endTime) {
                            secondInstruction.setOpacity(0.0, at: assets[counter].endTime)
                            print("Smaller")
                            break
                        }
                    }
                }
                if(counter < myTracks.count-1) {
                    if(assets[counter].layer.zPosition <= assets[counter+1].layer.zPosition) {
                        secondInstruction.setOpacity(0.0, at: assets[counter+1].beginTime)
                    }
                    else {
                        secondInstruction.setOpacity(0.0, at: assets[counter].endTime)
                    }
                }
                instructions.append(secondInstruction)
                counter += 1
            }
        }

        for range in ranges {
            firstInstruction.setOpacity(0.0, at: range.lowerBound)
            firstInstruction.setOpacity(1.0, at: range.upperBound)
        }

        // 2.3
        mainInstruction.layerInstructions = [firstInstruction] + instructions

        let imageLayer = CALayer()
        let image = UIImage(named: "Watermark")
        imageLayer.contents = image!.cgImage

        let ratio = (firstAsset.tracks(withMediaType: AVMediaTypeVideo)[0].naturalSize.width/image!.size.width)/2
        let rect = CGRect(x: image!.size.width*ratio, y: 0, width: image!.size.width*ratio, height: image!.size.height*ratio)
        imageLayer.frame = rect
        imageLayer.backgroundColor = UIColor.clear.cgColor
        imageLayer.opacity = 0.75

        let videoLayer = CALayer()
        videoLayer.frame = CGRect(x: 0, y: 0, width: firstAsset.tracks(withMediaType: AVMediaTypeVideo)[0].naturalSize.width, height: firstAsset.tracks(withMediaType: AVMediaTypeVideo)[0].naturalSize.height)

        let parentlayer = CALayer()
        parentlayer.frame = CGRect(x: 0, y: 0, width: image!.size.width*ratio, height: image!.size.height*ratio)
        parentlayer.addSublayer(videoLayer)
        parentlayer.addSublayer(imageLayer)

        let mainComposition = AVMutableVideoComposition()
        mainComposition.instructions = [mainInstruction]
        mainComposition.frameDuration = CMTimeMake(1, 30)
        mainComposition.renderSize = self.controller.firstAsset!.tracks(withMediaType: AVMediaTypeVideo)[0].naturalSize
        mainComposition.animationTool = AVVideoCompositionCoreAnimationTool(postProcessingAsVideoLayer: videoLayer, in: parentlayer)

【问题讨论】:

  • 您是否尝试在某个索引处访问某个资产的资产数组?或者您尝试访问不存在的对象的任何其他数组?
  • 我为与这种情况相关的那个类添加了我的代码
  • 你的代码中有很多地方都有这个[0]。您应该在执行此操作之前检查 count 是否大于零,如果 count 为零则记录错误。这应该是这次崩溃的原因。
  • 这不是完全符号化的,因为缺少行号。请解决这个问题。
  • 这是完全象征性的(据我所知)。我从 XCode 的 Organizer 获得了这个,它包含了一切。从那里,我下载了文件并在此处发布了其中的一部分(重要的部分)。我认为它显示为 0,因为它是专业的(据我了解的情况)

标签: ios swift xcode crash crash-reports


【解决方案1】:

很明显,“Merger.merge”方法访问了一个不存在的元素。调试器会告诉你它在哪里。

我猜想是某个线程在你背后修改了某个数组,因此在某个时候有效的索引变得无效。当您稍后修改“范围”时,“范围内的范围2”正在自找麻烦。

【讨论】:

  • 我从 XCodes Organizer 的测试人员那里得到了崩溃报告,但我无法重现该问题。因此,虽然断点测试会有所帮助,但我无法重现该问题。这就是为什么我使用来自 Apple 和 XCode 的 Organizer 的崩溃日志中的崩溃报告。如果您注意到,我会删除 1 个范围并始终添加另一个范围。我这样做是为了说:(1-10)但现在我想要(1-15)所以我删除(1-10)并附加(1-15)。
【解决方案2】:

考虑到 +1444 偏移量和数组访问,我猜测问题是由第 129 行引起的。您是否尝试过没有音频的视频,例如未经音频许可拍摄的视频?我假设在我的应用程序中拍摄的视频总是有音轨,因此遇到了越界崩溃。您会惊讶于用户将什么视频输入您的应用程序。我什至让一个用户使用从他们的手机相册中选择的 flv 视频使我的应用崩溃。

(我不确定这是否适用于 Swift) 也可以使用调试器在 Xcode 中定位该行。首先,您使用与发布版本相同的优化设置运行应用程序。然后你在函数中打破不同的行来检查汇编代码。 How to see assembly code in xcode 6。您可能需要滚动到顶部以仔细检查函数名称和偏移量的含义。

_ArrayBuffer._getElementSlowPath 是私有 API 中的一个类,由下划线前缀表示。您可能找不到任何关于它的可靠和/或官方消息来源。

崩溃日志中的不完整可能是由于 Swift(其背后的工具)的错误/不成熟造成的。欢迎使用最流行和炒作的语言之一。即使在工作条件下,Swift 也会为生成的代码提供第 0 行,其中代码与源代码的任何有意义的部分都不对应。不过这不是你的情况。

【讨论】:

  • 调试的问题是我似乎无法重现错误;只有一名测试人员。让这个过程变得异常复杂
  • 另外请注意,我提取的音频文件不是来自他们的音频,而是来自我们的视频。这也是一个有保证的视频。我们使用已经在应用程序中的预设视频并从那里开始。
  • 您删除了所有其他线程的堆栈跟踪。多线程问题仍然存在。假设不是多线程问题,无法重现问题意味着你还没有找到关键步骤。视频可以没有音轨。我不确定预设是什么。您是否努力为您的应用提供意想不到的视频?
  • 您的意思是音轨0来自应用捆绑的视频吗?
  • 正确(假设捆绑意味着来自应用程序内部,而不是从用户下载)。
猜你喜欢
  • 2018-02-12
  • 2011-09-09
  • 1970-01-01
  • 2018-09-05
  • 1970-01-01
  • 2010-11-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多