wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.66k stars 1.11k forks source link

Crash on posts list from missing author object in the json #5541

Closed oguzkocer closed 8 years ago

oguzkocer commented 8 years ago

We got a crash report from internal beta and I was unable to reproduce it from the UI. The issue is mostly clear, so I am filling the below info by reproducing it by altering the code:

Expected behavior

Viewing posts list shows the proper screen.

Actual behavior

Posts list crashes upon viewing the screen

Steps to reproduce the behavior

In order to reproduce the crash, the call to one of the posts endpoint need to return the json with missing author object. I am not sure in which case this happens. The app basically crashes when it parses the json. Example endpoint: https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/posts/

Here is the crash logs (stack trace cut short to keep it brief):

Hardware Model: iPhone8,2 Process: WordPress [1828] Path: /var/containers/Bundle/Application/27C106CE-3CD5-419F-954B-F1FFA106D510/WordPress.app/WordPress Identifier: org.wordpress.internal Version: 6.3.0.20160603.1 (6.3.0.20160603.1) Code Type: ARM-64 Parent Process: ??? [1]

Date/Time: 2016-06-08T05:48:53Z Launch Time: 2016-06-08T05:46:25Z OS Version: iPhone OS 9.3.2 (13F69) Report Version: 104

Exception Type: SIGABRT Exception Codes: #0 at 0x182f9c11c Crashed Thread: 0

Application Specific Information: *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1a1dfc490'

Last Exception Backtrace: 0 CoreFoundation 0x0000000183402db0 exceptionPreprocess + 124 1 libobjc.A.dylib 0x0000000182a67f80 objc_exception_throw + 52 2 CoreFoundation 0x0000000183409c4c -[NSObject(NSObject) doesNotRecognizeSelector:] + 208 3 CoreFoundation 0x0000000183406bec __forwarding + 868 4 CoreFoundation 0x0000000183304c5c _CF_forwarding_prep_0 + 88 5 WordPress 0x000000010007c4a8 -PostServiceRemoteREST remotePostFromJSONDictionary: 6 WordPress 0x0000000100118a68 -NSArray(WPMapFilterReduce) wp_map: 7 WordPress 0x000000010007c350 -PostServiceRemoteREST remotePostsFromJSONArray: 8 WordPress 0x000000010007a9ac 64-[PostServiceRemoteREST getPostsOfType:options:success:failure:]_block_invoke (PostServiceRemoteREST.m:87) 9 WordPress 0x000000010040c7b4 _TPATTRXFdCb_dPs9AnyObject_dGSqCSo17NSHTTPURLResponsedT__XFo_oPSoGSqS0_dT (WordPressComRestApi.swift:0) 10 WordPress 0x000000010040eb0c TFFC9WordPress19WordPressComRestApi3GETFTSS10parametersGSqGVs10DictionarySSPs9AnyObject7successFT14responseObjectPS212httpResponseGSqCSo17NSHTTPURLResponseT_7failureFT5errorCSo7NSError12httpResponseGSqS3_TGSqCSo10NSProgress_UFTCSo20NSURLSessionDataTaskPS2T_ (WordPressComRestApi.swift:94) 11 AFNetworking 0x0000000100adfda4 84-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:success:failure:]_block_invoke.74 (AFHTTPSessionManager.m:252) 12 AFNetworking 0x0000000100af3944 72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.71 (AFURLSessionManager.m:202) 13 libdispatch.dylib 0x0000000182e4d4bc _dispatch_call_block_and_release + 20 14 libdispatch.dylib 0x0000000182e4d47c _dispatch_client_callout + 12 15 libdispatch.dylib 0x0000000182e52b84 _dispatch_main_queue_callback_4CF + 1840 16 CoreFoundation 0x00000001833b8d50 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 8 17 CoreFoundation 0x00000001833b6bb8 __CFRunLoopRun + 1624 18 CoreFoundation 0x00000001832e0c50 CFRunLoopRunSpecific + 380 19 GraphicsServices 0x0000000184bc8088 GSEventRunModal + 176 20 UIKit 0x00000001885ca088 UIApplicationMain + 200 21 WordPress 0x0000000100007e7c main (main.m:5) 22 ??? 0x0000000182e7e8b8 0x0 + 0

oguzkocer commented 8 years ago

Closed in #5542.