I am using XCode 8 + Swift 3.
I created a fresh iOS project named "MyApp".
Then, I create a Cocoa touch framework project, named "MySubProject". (The idea is to have MyApp project accessing MySubProject code.)
They are on the same level folder:
- MyApp/
- MySubProject/
I added MySubProject into MyApp project, linked the MySubProject framework. Everything works fine. My project structure looks like this:
All works until here! (MyApp code can access MyService code)
Now, I need MySubProject to use Alamofire to communicate with backend. So, under MySubProject/
I setup the Alamofire with CocoaPod, which creates the MySubProject.xcworkspace
.
I think I need to remove the previous MySubProject.xcodeproj
and using MySubProject.xcworkspace
, so I deleted the reference of MySubProject.xcodeproj
& add the MySubProject.xcworkspace
to MyApp
, it then looks like this:
As you can see, I can not see the source code of MySubProject now.
What is the correct way to use Alamofire or any 3rd party library through CocoaPod in Framework sub-project?
===== UPDATE ======
I need to add Alamofire into MySubProject
, not MyApp
. I followed instruction in Alamofire offical website to manually add Alamofire to MySubProject
, the project structure then looks like this:
- MyApp
- MySubProject.xcodeproj
-Alamofire.xcodeproj
After that, I can access Alamofire in MySubProject, no compile error. However, when I run my app in emulator, I got runtime error:
Referenced from: /Users/myname/Library/Developer/Xcode/DerivedData/MyApp-hezjlyvzxnavccenabxdepgftbrg/Build/Products/Debug-iphonesimulator/Alamofire.framework/Alamofire
Reason: image not found
How to solve that?