Post

Replies

Boosts

Views

Activity

I can't fix it SIGTRAP
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(...). 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. 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. 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 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() 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.
2
0
6.0k
Aug ’20
Location permission request popup not working as expected in iPad split view
Hi I am working on my app to support ipad split view. My problem is that the location permission request popup doesn't appear immediately when split view is activated. The summarized code is below. import CoreLocation class MyViewController: UIViewController {   var locationManager = CLLocationManager()   //skip code...    @objc func touchUpInsideLocationButton(_ sender: Any) {     self.locationManager.requestWhenInUseAuthorization()   } } After the code that handles the button touch is executed, the system popup requesting the location permission does not appear. When I close the iPad split view (Drag the app divider to the left or right edge of the screen), a system popup appears at that time. When requesting permission to access photos in iPad split view, a system pop-up appeared immediately. The location information permission popup should also appear immediately, but I'm not sure if it's a bug or the intended behavior. Please help. Have a nice day 😄
4
0
2.8k
Jul ’21