Search code examples
iosobjective-cafnetworkingfreeze

How do I debug freezing issue in my iOS app


I have an app made with Objective-C. This app always worked right. Yesterday, my Xcode was ignoring anything new that I created, so I updated it to Xcode 10.1 (10B61). Anyway, I was editing another app, not the following one.

A version of the app have been updated on App Store after that (I sent it 2 days ago) and 18pm my boss call me on my phone and told me that the app was crashing.

Today, I verified that the app isn't crashing, it is freezing. It is freezing when any of those things happens:

  1. Open or close the keyboard
  2. Open or close any activity
  3. Do a request using AFNetworking framework

I tried do a git checkout to the init of the month, it still didn't worked. So I did a checkout to the init of the past month (9th October) and it is still freezing. But those versions of the app was working with no errors.

I tried debug it until on the assembly, I could fix AFNetworking changing the Framework's code for the first time ever. There is a dispatch_sync freezing the app when it try to set the request's header, I can change it to dispatch_async and it fix 1/3 of the problem, the requests are still working on async. Line: ./Pods/AFNetworking/Serialization/AFURLRequestSerialization.m:306

- (NSDictionary *)HTTPRequestHeaders {
    NSDictionary __block *value;
    dispatch_sync(self.requestHeaderModificationQueue, ^{
        value = [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders];
    });
    return value;
}

Now my boss told me that all the two apps are freezing. And I didn't updated anything in the first app mentioned. The apps are from the same project, they works like an Uber.

Anyone have some idea of what is happening?

====EDIT0====

Currently we noticed that the app can be build in another computer and it word like before. So the apps that are being build in my Mac are freezing, the problem is not the code, some library, update or whatever. Probably it is my computer, we will try to use another mac to build and send the apps.

If it resolves the problem, I will put the solution here and get a talk with Apple Support.


Solution

  • The problem was that every iOS app that is builded in my Mac starts to random freeze in dispatch_sync functions. I will try format my PC or buy a new one.

    It makes literally no sense, but solved the problem.