atlantis
atlantis copied to clipboard
Objective-C error 'Atlantis-Swift.h' file not found.
Hello, first of all, thanks to proxyman, it's super easy to debug network traffic.
I'm trying to integrate Atlantis in my objective-C AppDelegate.m
. but the Xcode build fails with the error 'Atlantis-Swift.h' file not found.
I followed the README.md documentation and added #import "Atlantis-Swift.h"
.
I'm using the Atlantis version 1.7.1 (installed using cocoapods)
Thanks in advance.
Thanks for the bug. Let me investigate it with the Objc Project
Hey @apostopher
I've just created a new Objective-C Project and integrate Atlantis by Cocoapod. I didn't get any problem.
![Screen Shot 2021-02-10 at 09 00 12](https://user-images.githubusercontent.com/5878421/107453935-92549480-6b7e-11eb-94fe-d5285f5b4383.png)
#import "AppDelegate.h"
#import "Atlantis-Swift.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[Atlantis startWithHostName:nil];
return YES;
}
Can you download and run this objc example: https://www.dropbox.com/s/k9cbdqhmyil5lo6/Objective-C-Example.zip?dl=0
@NghiaTranUIT thanks for a quick reply. sure. I'll try it on my end.
You're welcome @apostopher Please let me know the result 😄
@NghiaTranUIT it worked in your project. I'm using react-native. and it's still failing. I'll investigate the issue and update this thread.
I'm not sure if Atlantis could work with React-Native if the Network library in your project doesn't use URLSession to make a Request.
Do you know a React-native example that I can test out? 🤔
I think react-native's fetch API internally uses NSURLSession. I'll try a sample app tomorrow. I'll share my findings with you.
@NghiaTranUIT i investigated the issue and here are my 2 cents:
This error happens if the Podfile
does not have use_frameworks!
line.
Unfortunately in my case if i add use_frameworks!
my other deps fail to build. :-(
@apostopher can you fork the project, remove the use_frameworks!
and see if it works for you 🤔
@NghiaTranUIT I cloned this project https://www.dropbox.com/s/k9cbdqhmyil5lo6/Objective-C-Example.zip?dl=0 and tried without use_frameworks!
and I can reproduce the same error.
Thanks. Let me check it out 👍
Solution
🎉 I found a working solution using a plugin called cocoapods-user-defined-build-types
- Install the gem:
$ gem install cocoapods-user-defined-build-types
- Add these above your target in
Podfile
plugin 'cocoapods-user-defined-build-types'
enable_user_defined_build_types!
- Add atlantis pod:
pod 'atlantis-proxyman', :build_type => :dynamic_framework
This fixed my issue and Atlantis works perfectly.
Original Comment
I'm running into this exact issue.
I've confirmed the pod was installed, it shows up in Podfile.lock
. atlantis-proxyman (1.12.0)
Tried cleaning before building and it did not help.
React Native project - Running on M1 (arm64) Xcode 13.1 (13A1030d) MacOS 12.0.1
Solution
🎉 I found a working solution using a plugin called cocoapods-user-defined-build-types
- Install the gem:
$ gem install cocoapods-user-defined-build-types
- Add these two lines above your target in
Podfile
:
plugin 'cocoapods-user-defined-build-types'
enable_user_defined_build_types!
- Add atlantis pod:
pod 'atlantis-proxyman', :build_type => :dynamic_framework
This fixed my issue and Atlantis works perfectly.
Awesome 👍 I might add a public header to in SPM, so you can use SPM on Objective-C project 👍
that's great news! thanks, @archcorsair for the solution. and a million thanks to @NghiaTranUIT for the awesome proxyman and atlantis!
do you have plans to support android too?
Unfortunately, I don't have any plan to bring Atlantis to Android because I have no experience on Android and Atlantis is heavily depends on Method Swizzling and URLSession, which are not available on Android world.
It seems that adding the public header to use SPM on the Objective-C project is not possible in terms of technical limitations. Thread: https://forums.swift.org/t/how-to-import-swift-package-into-objective-c-using-xcode/43978/15
Http proxy works fine in RN project using cocoapods-user-defined-build-types solution, but websocket doesn't work. Is it possible to extend RN implementation to support atlantis?
@archcorsair , followed your instructions, to no avail
[!] Invalid `Podfile` file: undefined method `enable_user_defined_build_types!' for an instance of Pod::Podfile
@rolfen do you use React Native or native iOS app 🤔
I've created a Objective-C iOS project again, and Cocoapod works fine with Atlantis. No need to use enable_user_defined_build_types
Http proxy works fine in RN project using cocoapods-user-defined-build-types solution, but websocket doesn't work. Is it possible to extend RN implementation to support atlantis?
It's a known issue because React Native doesn't use native URLWebsocketSession to make a WS/WSS. They use their own WS socket. Thus, Atlantis doesn't work.
@rolfen do you use React Native or native iOS app 🤔
I've created a Objective-C iOS project again, and Cocoapod works fine with Atlantis. No need to use
enable_user_defined_build_types
I use react-native trying to build ios.
I tried the workaround suggested by @archcorsair and after many additional steps to be able to install the plugin (install rbenv, update ruby, update this update that, etc.) I finally hit this error on pod install
so gave up on atlantis.
Flipper or proxyman(+helper) seem to work for my needs.
Changing the use_frameworks!
setting will break the build somewhere else.
Can you use SPM on your react-native app? @rolfen
I will checkout the react-native + Atlantis today
@rolfen I follow this solution and it works fine: https://github.com/ProxymanApp/atlantis/issues/56#issuecomment-958427958
Note: I don't use use_frameworks!
in the Podfile