Search code examples
iosobjective-cxcodeswaggerswagger-codegen

Objective c client generated from swagger-codegen is not working properly when imported mannually in project


I have generated Objective c client from swagger.json. And imported the generated source in my Xcode project by Right clicking on project then choosing Add Files to "ProjectName". As swagger-codegen generated source has dependency on ISO8601, JSONModel and AFNetworking, so i downloaded them and added in my project. Project is building successfully but it is not working properly. When i invoke any API call by using functions inside Api folder it is unable to invoke function inside Core folder. I tried putting debug point in function inside Core folder but flow of control is not reaching there, and Xcode is not showing any error either.

Surprisingly generated code is working fine if i add it as cocoapod dependency.

But i don't want to use cocoapod in my project.

What step am i missing in importing it manually? And why Xcode is not throwing any error?


Solution

  • Finally i found the problem "Pheww!", Hope it may help others.

    Actually i was using frameworks of all three dependencies, and app was crashing at start. I found somewhere that making them Optional in Linked Frameworks and Libraries will stop the app from crashing, and indeed crash gone.

    But doing that caught me in this weird schenario.

    So the solution for this problem is to keep them Required and add one New Copy Files Pahse in Build Phases and choose Frameworks in destination. I renamed that as Embed Framework.

    new copy files phase

    And just cross verify the frameworks, In General tab

    enter image description here