diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj index 207b8c8495..ffeb092cfb 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj @@ -1243,6 +1243,7 @@ ALWAYS_SEARCH_USER_PATHS = YES; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; COMBINE_HIDPI_IMAGES = YES; + CONFIGURATION_BUILD_DIR = ../../../runtime/mac; GCC_DYNAMIC_NO_PIC = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = mac/Prefix.pch; diff --git a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/Runtime_ios-mac.mm b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/Runtime_ios-mac.mm index f89ad9bc02..ffa8f82acc 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/Runtime_ios-mac.mm +++ b/templates/lua-template-runtime/frameworks/runtime-src/proj.ios_mac/Runtime_ios-mac.mm @@ -21,8 +21,12 @@ string getIPAddress() if (cursor->ifa_addr->sa_family == AF_INET && (cursor->ifa_flags & IFF_LOOPBACK) == 0) { NSString *name = [NSString stringWithUTF8String:cursor->ifa_name]; - if ([name isEqualToString:@"en0"]) // Wi-Fi adapter - return [[NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)cursor->ifa_addr)->sin_addr)]UTF8String]; + if ([name rangeOfString:@"en" options:NSCaseInsensitiveSearch].length > 0) { + string ipaddr = [[NSString stringWithUTF8String:inet_ntoa(((struct sockaddr_in *)cursor->ifa_addr)->sin_addr)]UTF8String]; + if (!ipaddr.empty()) { + return ipaddr; + } + } } cursor = cursor->ifa_next; }