Hello.
A crash occurs in the deployed app, but it has not been resolved for several months, so we ask if you can help.
The crash log appears to cause SIGTRAP when calling addMissionCards(...).
I saw the Apple development documentation as SIGTRAP happens when the force unwrapp object is nil.
So, even though items and missionCards that are passed as arguments to the addMissionCard(...) function are optional binding, there is still a problem.
Over the past few months, I've been adding defense codes to potentially problematic areas, but I haven't earned any income.
Please help me.
Thank you.
A crash occurs in the deployed app, but it has not been resolved for several months, so we ask if you can help.
The crash log appears to cause SIGTRAP when calling addMissionCards(...).
Code Block private func addMissionCards(toParsedItems items: inout [AnyObject], missionCards: [JHFeedMissionCard], existingItemsCount: Int) {
I saw the Apple development documentation as SIGTRAP happens when the force unwrapp object is nil.
Code Block Swift code will terminate with this exception type if an unexpected condition is encountered at runtime such as: a non-optional type with a nil value a failed forced type conversion
So, even though items and missionCards that are passed as arguments to the addMissionCard(...) function are optional binding, there is still a problem.
Over the past few months, I've been adding defense codes to potentially problematic areas, but I haven't earned any income.
Code Block Exception Type: SIGTRAP Exception Codes: #0 at 0x1035558a0 Crashed Thread: 0 Thread 0 Crashed: 0 MyApp 0x00000001035558a0 MyApp.FeedViewController.(addMissionCards in _4A155E3DD07CD1B17F1F3B23BDE0CF62)(toParsedItems: inout [Swift.AnyObject], missionCards: [C.JHFeedMissionCard], existingItemsCount: Swift.Int) -> () (in MyApp) (<compiler-generated>:0) 1 MyApp 0x0000000103558378 closure #1 ([Swift.AnyObject?]?, [Swift.AnyObject]?, Swift.Error?) -> () in MyApp.FeedViewController.(fetchPublicPopular in _4A155E3DD07CD1B17F1F3B23BDE0CF62)(with: [Swift.String : Any]?) -> () (in MyApp) (<compiler-generated>:0) 2 MyApp 0x000000010356c1c8 closure #1 ([Swift.String : Any]?, Swift.Error?) -> () in MyApp.FeedViewController.(parseFetchResponse in _4A155E3DD07CD1B17F1F3B23BDE0CF62)(withExistingItems: [Swift.AnyObject], completion: ([Swift.AnyObject?]?, [Swift.AnyObject]?, Swift.Error?) -> ()) -> ([Swift.String : Any]?, Swift.Error?) -> ()? (in MyApp) (<compiler-generated>:0) 3 MyApp 0x0000000103ad2c08 closure #2 (Any?, Swift.Error?) -> () in static MyApp.API.Feed.getFeed(nextParams: [Swift.String : Any]?, adPayLoad: [Swift.String : Any]?, completion: ([Swift.String : Any]?, Swift.Error?) -> ()?) -> C.JHAPI (in MyApp) (<compiler-generated>:0) 4 MyApp 0x000000010397a630 reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed Any?, @guaranteed Swift.Error?) -> () to @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?, @unowned __C.NSError?) -> () (in MyApp) (<compiler-generated>:0) 5 MyApp 0x0000000102ab8f68 _completionBlock_block_invoke (in MyApp) (JHAPI.m:53) 6 MyApp 0x00000001028f4974 _66-[JHHTTPDefaultResponseCompletion completionWithFetcher:context:]_block_invoke (in MyApp) (JHHTTPDefaultResponseCompletion.m:15) 7 libdispatch.dylib 0x000000019e39e134 0x19e39c000 + 8500
Code Block API.Feed.getFeed(nextParams: nil, adPayLoad: self.adPayloadContainedFirstContentsCardGlobalIndex(), completion: self.parseFetchResponse(withExistingItems: [], completion: { [weak self] (fetchedItems, adContentDatas, error) in guard let unwrappedSelf = self else { return } if var fetchedItems = fetchedItems?.compactMap({ $0 }), !fetchedItems.isEmpty { if let missionCards = unwrappedSelf.missionCards?.filter({ $0.needToShow() }), !missionCards.isEmpty { unwrappedSelf.addMissionCards(toParsedItems: &fetchedItems, missionCards: missionCards, existingItemsCount: 0) // crash point 😭 } } }.call()
Code Block private func parseFetchResponse(withExistingItems existingItems: [AnyObject] = [], completion: @escaping ([AnyObject?]?, [AnyObject]?, Error?) -> Void) -> [String: Any]? { return { [weak self] (response, error) in var items = [AnyObject]() // response to items // ... completion(items, adContentDatas, nil) } }
Please help me.
Thank you.
That’s true, but it’s only part of the story. The Swift runtime will raise SIGTRAP in a variety of different circumstances. A really common one is force unwrapping an optional that’s nil, but there are many others, including array bounds check, failed type conversion, and so on.I saw the Apple development documentation as SIGTRAP happens when the force unwrapp object is nil.
It’s hard to say what the runtime is complaining about here. If you were able to reproduce this with a Debug build then you’d get a nice message explaining the problem. That doesn’t help if you’re trying to debug reports coming in from the field.
In your shoes I’d disassemble the code for the function in frame 0 to see how it got to that specific trap.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"