diff --git a/integrations/apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.pbxproj b/integrations/apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.pbxproj index 9365564..8e53f35 100644 --- a/integrations/apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.pbxproj +++ b/integrations/apple/ZeroTierSDK_Apple/ZeroTierSDK_Apple.xcodeproj/project.pbxproj @@ -890,6 +890,7 @@ }; 7CC003221D1216E3003E68DC = { CreatedOnToolsVersion = 7.3; + DevelopmentTeam = 57AG88JR8A; }; 7CC0032F1D1216F8003E68DC = { CreatedOnToolsVersion = 7.3; @@ -1414,6 +1415,7 @@ 7CC003291D1216E3003E68DC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1436,6 +1438,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1445,6 +1448,7 @@ 7CC0032A1D1216E3003E68DC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -1466,6 +1470,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-iOS"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; diff --git a/integrations/apple/example_app/OSX/Example_OSX_App.xcodeproj/project.pbxproj b/integrations/apple/example_app/OSX/Example_OSX_App.xcodeproj/project.pbxproj index 88cfeec..436963f 100644 --- a/integrations/apple/example_app/OSX/Example_OSX_App.xcodeproj/project.pbxproj +++ b/integrations/apple/example_app/OSX/Example_OSX_App.xcodeproj/project.pbxproj @@ -35,7 +35,6 @@ 7C74DACD1D3C46EB00A6C0B9 /* SDK_XcodeWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDK_XcodeWrapper.cpp; path = ../../../../../src/SDK_XcodeWrapper.cpp; sourceTree = ""; }; 7C74DACE1D3C46EB00A6C0B9 /* SDK_XcodeWrapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SDK_XcodeWrapper.hpp; path = ../../../../../src/SDK_XcodeWrapper.hpp; sourceTree = ""; }; 7C74DAD01D3C472C00A6C0B9 /* ZeroTierSDK_OSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_OSX.framework; path = ../../../../build/osx_app_framework/Debug/ZeroTierSDK_OSX.framework; sourceTree = ""; }; - 7CF8E36D1D2C40F6001A8401 /* Example_OSX_App-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example_OSX_App-Bridging-Header.h"; sourceTree = ""; }; 7CFCB42D1D1AFEE800D3E66C /* Example_OSX_App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example_OSX_App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7CFCB4301D1AFEE800D3E66C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7CFCB4321D1AFEE800D3E66C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -84,7 +83,6 @@ 7CFCB4341D1AFEE800D3E66C /* Assets.xcassets */, 7CFCB4361D1AFEE800D3E66C /* Main.storyboard */, 7CFCB4391D1AFEE800D3E66C /* Info.plist */, - 7CF8E36D1D2C40F6001A8401 /* Example_OSX_App-Bridging-Header.h */, ); path = Example_OSX_App; sourceTree = ""; @@ -276,8 +274,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Example_OSX_App/Example_OSX_App-Bridging-Header.h"; - "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "Example_OSX_App/Example_OSX_App-Bridging-Header.h"; + SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/SDK_Apple-Bridging-Header.h"; + "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "$(PROJECT_DIR)/../../../../src/SDK_Apple-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -294,7 +292,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-OSX-App"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Example_OSX_App/Example_OSX_App-Bridging-Header.h"; + SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/SDK_Apple-Bridging-Header.h"; }; name = Release; }; diff --git a/integrations/apple/example_app/OSX/Example_OSX_App/Example_OSX_App-Bridging-Header.h b/integrations/apple/example_app/OSX/Example_OSX_App/Example_OSX_App-Bridging-Header.h deleted file mode 100644 index 311657b..0000000 --- a/integrations/apple/example_app/OSX/Example_OSX_App/Example_OSX_App-Bridging-Header.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Use this file to import your target's public headers that you would like to expose to Swift. -// - -#ifndef Example_OSX_Bridging_Header_h -#define Example_OSX_Bridging_Header_h - -int start_intercept(); -void start_service(const char * path); -void join_network(const char * nwid); -void disable_intercept(); -void enable_intercept(); - -#include -#include "SDK_Signatures.h" - -void zt_join_network(const char *nwid); -void zt_leave_network(const char *nwid); - -// Direct Call ZT API -// These functions will provide direct access to ZT-enabled sockets with no hassle -int zts_init_rpc(const char *path, const char *nwid); -int zts_connect(CONNECT_SIG); -int zts_bind(BIND_SIG); -int zts_accept(ACCEPT_SIG); -int zts_listen(LISTEN_SIG); -int zts_socket(SOCKET_SIG); -int zts_setsockopt(SETSOCKOPT_SIG); -int zts_getsockopt(GETSOCKOPT_SIG); -int zts_close(CLOSE_SIG); -int zts_getsockname(GETSOCKNAME_SIG); - - -#endif /* Example_OSX_Bridging_Header_h */ - - diff --git a/integrations/apple/example_app/iOS/Example_iOS_App.xcodeproj/project.pbxproj b/integrations/apple/example_app/iOS/Example_iOS_App.xcodeproj/project.pbxproj index 79273e0..cea1dff 100644 --- a/integrations/apple/example_app/iOS/Example_iOS_App.xcodeproj/project.pbxproj +++ b/integrations/apple/example_app/iOS/Example_iOS_App.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 7C8BC0461D3348A6001E1B6F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7C8BC0441D3348A6001E1B6F /* LaunchScreen.storyboard */; }; 7C9B10DA1D36C81F005BA825 /* ZeroTierSDK_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */; }; 7C9B10DB1D36C81F005BA825 /* ZeroTierSDK_iOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 7CE8BFAB1D3C553400350023 /* SDK_XcodeWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE8BFA91D3C553400350023 /* SDK_XcodeWrapper.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -39,6 +40,8 @@ 7C8BC0451D3348A6001E1B6F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 7C8BC0471D3348A6001E1B6F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 7C9B10D81D36C615005BA825 /* ZeroTierSDK_iOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZeroTierSDK_iOS.framework; path = "../../../../build/ios_app_framework/Debug-iphoneos/ZeroTierSDK_iOS.framework"; sourceTree = ""; }; + 7CE8BFA91D3C553400350023 /* SDK_XcodeWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SDK_XcodeWrapper.cpp; path = ../../../../../src/SDK_XcodeWrapper.cpp; sourceTree = ""; }; + 7CE8BFAA1D3C553400350023 /* SDK_XcodeWrapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SDK_XcodeWrapper.hpp; path = ../../../../../src/SDK_XcodeWrapper.hpp; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -73,6 +76,8 @@ 7C8BC03A1D3348A6001E1B6F /* Example_iOS_App */ = { isa = PBXGroup; children = ( + 7CE8BFA91D3C553400350023 /* SDK_XcodeWrapper.cpp */, + 7CE8BFAA1D3C553400350023 /* SDK_XcodeWrapper.hpp */, 7C8BC03B1D3348A6001E1B6F /* AppDelegate.swift */, 7C8BC03D1D3348A6001E1B6F /* ViewController.swift */, 7C8BC03F1D3348A6001E1B6F /* Main.storyboard */, @@ -116,6 +121,7 @@ TargetAttributes = { 7C8BC0371D3348A6001E1B6F = { CreatedOnToolsVersion = 7.3; + DevelopmentTeam = 57AG88JR8A; }; }; }; @@ -156,6 +162,7 @@ buildActionMask = 2147483647; files = ( 7C8BC03E1D3348A6001E1B6F /* ViewController.swift in Sources */, + 7CE8BFAB1D3C553400350023 /* SDK_XcodeWrapper.cpp in Sources */, 7C8BC03C1D3348A6001E1B6F /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -271,10 +278,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../../../build/iOS_app_framework/debug-iphoneos"; INFOPLIST_FILE = Example_iOS_App/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(SRC_ROOT)/../../"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-iOS-App"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/SDK_Apple-Bridging-Header.h"; }; name = Debug; }; @@ -282,10 +294,15 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../../../build/iOS_app_framework/debug-iphoneos"; INFOPLIST_FILE = Example_iOS_App/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(SRC_ROOT)/../../"; PRODUCT_BUNDLE_IDENTIFIER = "zerotier.Example-iOS-App"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; + SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/../../../../src/SDK_Apple-Bridging-Header.h"; }; name = Release; }; diff --git a/integrations/apple/example_app/iOS/Example_iOS_App/ViewController.swift b/integrations/apple/example_app/iOS/Example_iOS_App/ViewController.swift index cea6934..3232838 100644 --- a/integrations/apple/example_app/iOS/Example_iOS_App/ViewController.swift +++ b/integrations/apple/example_app/iOS/Example_iOS_App/ViewController.swift @@ -10,8 +10,27 @@ import UIKit class ViewController: UIViewController { + var service_thread : NSThread! + func ztnc_start_service() { + let path = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true) + print("start_service()\n") + // e5cd7a9e1c3511dd + start_service("/Users/Joseph/utest3") + //start_service(path[0]) + } + override func viewDidLoad() { super.viewDidLoad() + + // ZeroTier Service thread + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), { + self.service_thread = NSThread(target:self, selector:"ztnc_start_service", object:nil) + self.service_thread.start() + }); + + // Set RPC path for this thread + zts_init_rpc("/Users/Joseph/utest3/nc_","e5cd7a9e1c2e194f"); + // Do any additional setup after loading the view, typically from a nib. }