floatinghotpot / cordova-httpd

Embed tiny web server into Cordova with a plugin
284 stars 149 forks source link

cordova-plugin-httpd breaks iOS build #37

Closed paulrenn67 closed 1 year ago

paulrenn67 commented 8 years ago

I'm having an issue with cordova-plugin-httpd on iOS which seems to be easily reproducible with the following steps:

cordova create com.cordova.test cordova add platform ios cordova plugin add cordova-plugin-console cordova build ios

Everything OK, app builds and runs with the usual "ready" logo flashing.

` cordova plugin add cordova-plugin-httpd

cordova build ios `

Build fails with the following:

\ BUILD FAILED **

The following build commands failed: CompileC build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/CorHttpd.o HelloCordova/Plugins/cordova-plugin-httpd/CorHttpd.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/paul/git/test/test/cordova_test/com.cordova.test/platforms/ios/cordova/build-debug.xcconfig,-project,HelloCordova.xcodeproj,ARCHS=i386,-target,HelloCordova,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/paul/git/test/test/cordova_test/com.cordova.test/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/paul/git/test/test/cordova_test/com.cordova.test/platforms/ios/build/sharedpch You may not have the required environment or OS to build this project Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/paul/git/test/test/cordova_test/com.cordova.test/platforms/ios/cordova/build-debug.xcconfig,-project,HelloCordova.xcodeproj,ARCHS=i386,-target,HelloCordova,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/paul/git/test/test/cordova_test/com.cordova.test/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/paul/git/test/test/cordova_test/com.cordova.test/platforms/ios/build/sharedpch

cordova plugin rm cordova-plugin-httpd cordova build ios

Build succeeds again.

I'm using I think latest XCode, iOS, and Cordova.

cordova -v 6.0.0

cordova plugin list cordova-plugin-console 1.0.2 "Console" cordova-plugin-httpd 0.9.2 "CorHttpd" cordova-plugin-whitelist 1.2.1 "Whitelist"

XCode Version 7.2.1 (7C1002)

I initially developed an app using rjfun plugin, and it ran successfully, but have issues now with new plugin name for a new project. Is there some configuration issue?

Thanks, Paul

t-chab commented 8 years ago

Hello,

Same problem here, did you find a workaround ?

t-chab commented 8 years ago

Full steps to reproduce :

$ cordova create com.cordova.test
$ cd com.cordova.test
$ cordova platform add ios
$ cordova plugin add cordova-plugin-httpd
$ cordova build
t-chab commented 8 years ago

Ok I found a workaround, not sure why it works, but still ...

In file platforms/ios/HelloCordova/Plugins/cordova-plugin-httpd/CorHttpd.m move line

@implementation CorHttpd

after the #define block, juste before line

- (NSString *)getIPAddress:(BOOL)preferIPv4

then it build.

Does it works for you ?

t-chab commented 8 years ago

Here's the diff

@@ -29,8 +29,6 @@

 @end

-@implementation CorHttpd
-
 #include <ifaddrs.h>
 #include <arpa/inet.h>
 #include <net/if.h>
@@ -47,6 +45,8 @@
 #define IP_LOCALHOST        @"127.0.0.1"
 #define IP_ANY              @"0.0.0.0"

+@implementation CorHttpd
+
 - (NSString *)getIPAddress:(BOOL)preferIPv4
 {
     NSArray *searchArray = preferIPv4 ?
richardbrammer commented 7 years ago

This works and should be a pull request, shouldn't it?

paulrenn67 commented 1 year ago

Closed due to old age 👴