0

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?

2 Answers2

1

If you are importing the dependancies manually instead of using cocoapods then you have to change the import statements from

#import <JSONModel/JSONModel.h>

to

#import "JSONModel.h"

and the same for all of the AFNetworking imports

Jon Rose
  • 8,373
  • 1
  • 30
  • 36
  • I came through that problem when i imported the `JSONModel` as source code, Xcode used to give error then, but importing the framework of dependencies, project is building fine. The problem is neither Xcode is giving any error nor flow of control is going to that method. @JonRose Any idea what might be problem there? – HelioVaGator Feb 27 '17 at 09:36
  • I also imported the dependancies manually instead of using cocoapods and changing the `#import` statements worked for me. – Jon Rose Feb 27 '17 at 10:25
0

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