Post

Replies

Boosts

Views

Activity

Network Extension function startTunnelWithOptions is never triggered
the code of my app @interface VPNManager() @property (nonatomic, strong) VPNManagerModel *vpnConfigurationModel; @property (nonatomic, strong) NEVPNManager *manager; @property (nonatomic, assign) NSInteger writeAmount; @end @implementation VPNManager - (BOOL)startVPN { [[NSNotificationCenter defaultCenter] postNotificationName:@"showError" object:self userInfo:@{@"info": @"configManagerWithModel"}]; if (self.vpnManager.connection.status == NEVPNStatusDisconnected) { NSError *error; [self.vpnManager.connection startVPNTunnelAndReturnError:&error]; if (error != 0) { const char *errorInfo = [NSString stringWithFormat:@"%@",error].UTF8String; [[NSNotificationCenter defaultCenter] postNotificationName:@"showError" object:self userInfo:@{@"info": [NSString stringWithFormat:@"Start VPN Failed -%@",error]}]; }else { //point A [[NSNotificationCenter defaultCenter] postNotificationName:@"showError" object:self userInfo:@{@"info": @"Start VPN Success !"}]; return YES; } }else { [[NSNotificationCenter defaultCenter] postNotificationName:@"showError" object:self userInfo:@{@"info":[NSString stringWithFormat:@"Start VPN - The current connect status isn't NEVPNStatusDisconnected ! %ld",self.vpnManager.connection.status] }]; } return NO; }and PacketTunnelProvider Network Extension #import "PacketTunnelProvider.h" #include #include #include #define _NET_MTU 1400 #define _NET_REMOTEADDRESS "10.10.10.1" #define _NET_SUBNETMASKS "255.255.255.255" #define _NET_DNS "8.8.8.8" #define _LOCAL_ADDRESS "127.0.0.1" #define _NET_TUNNEL_IPADDRESS "10.8.0.2" @interface PacketTunnelProvider () @property NWTCPConnection *connection; @property (strong) void (^pendingStartCompletion)(NSError *); @end @implementation PacketTunnelProvider - (void)startTunnelWithOptions:(NSDictionary *)options completionHandler:(void (^)(NSError *))completionHandler{ //point B [[NSNotificationCenter defaultCenter] postNotificationName:@"showError" object:nil userInfo:nil]; //send message to notify has been triggered NEPacketTunnelNetworkSettings *tunnelNetworkSettings = [[NEPacketTunnelNetworkSettings alloc] initWithTunnelRemoteAddress:@_NET_REMOTEADDRESS]; tunnelNetworkSettings.MTU = [NSNumber numberWithInteger:_NET_MTU]; tunnelNetworkSettings.IPv4Settings = [[NEIPv4Settings alloc] initWithAddresses:[NSArray arrayWithObjects:@_NET_TUNNEL_IPADDRESS, nil] subnetMasks:[NSArray arrayWithObjects:@_NET_SUBNETMASKS, nil]]; tunnelNetworkSettings.IPv4Settings.includedRoutes = @[[NEIPv4Route defaultRoute]]; NEIPv4Route *excludeRoute = [[NEIPv4Route alloc] initWithDestinationAddress:@"10.12.23.90" subnetMask:@"255.255.255.255"]; tunnelNetworkSettings.IPv4Settings.excludedRoutes = @[excludeRoute]; [self setTunnelNetworkSettings:tunnelNetworkSettings completionHandler:^(NSError * _Nullable error) { if (error == nil) { log4cplus_info("VPNManager", "PacketTunnelManager - Start Tunel Success !"); completionHandler(nil); }else { log4cplus_error("VPNManager", "PacketTunnelManager - Start Tunel Failed - %s !",error.debugDescription.UTF8String); completionHandler(error); return; } }]; [self readPakcets]; }point A can be triggered, start VPN and show VPN icon on left top of iPhone correctly.but point B never be triggeredyour comment welcome
0
0
510
May ’20
change developer account country
It is time to renew my membership of Apple developer.I just moved to Canada from China.Thus I need to change the country of my account from China to CanadaApple sent me the link for uploading my new address document:https://developer.apple.com/contact/file-upload/?teamId=KJ68GN9SKAI logged on my account then clicked the link above, there is a empty web page andno way to upload my file.I checked the source code of the web page above, it displayed as below.It looked like there are contents, but nothing display in web browser.Even Apple can not explain, they could not reproduce my problem in their web browseryour comment welcome<!DOCTYPE html> <html lang="en"> <head> <!-- Charset --> <meta charset="utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="Author" content="Apple Inc." /> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, IE=9"> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" /> <link rel="mask-icon" href="/apple-logo.svg" color="#333333"> <link rel="stylesheet" href="/assets/styles/globalnav.css" type="text/css" /> <link rel="stylesheet" href="/assets/styles/global.dist.css" type="text/css" /> <!--[if lt IE 9]> <link rel="stylesheet" href="/assets/styles/oldie.css" type="text/css" /> <script src="/assets/scripts/html5.js"></script> <![endif]--> <script src="/assets/scripts/lib/jquery/jquery-1.11.0.min.js"></script> <script src="/assets/scripts/lib/jquery/jquery.retinate.js"></script> <script src="/assets/scripts/global.js"></script> <script src="/assets/scripts/global-logout.js"></script> <link rel="stylesheet" href="https://www.apple.com/wss/fonts?family=SF+Pro&v=1" type="text/css" /> <link rel="stylesheet" href="https://www.apple.com/wss/fonts?family=SF+Pro+Icons&v=1" type="text/css" /> <link rel="stylesheet" href="https://www.apple.com/wss/fonts?family=SF+Mono&v=1" type="text/css" /> <link rel="stylesheet" href="https://www.apple.com/wss/fonts?family=Apple+Icons&v=1" type="text/css" /> <!-- Content metadata --> <title>File Upload - Contact - Apple Developer</title> <meta name="omni_page" content="File Upload - Contact" /> <meta name="Description" content=""> <!-- Styles --> <link rel="stylesheet" href="./scripts/app/app.css"></link> </head> <body> <input type="checkbox" id="ac-gn-menustate" class="ac-gn-menustate"> <nav id="ac-globalnav" class="no-js" role="navigation" aria-label="Global Navigation" data-hires="false" data-analytics-region="global nav" lang="en-US"> <div class="ac-gn-content"> <ul class="ac-gn-header"> <li class="ac-gn-item ac-gn-menuicon"> <label class="ac-gn-menuicon-label" for="ac-gn-menustate" aria-hidden="true"> <span class="ac-gn-menuicon-bread ac-gn-menuicon-bread-top"> <span class="ac-gn-menuicon-bread-crust ac-gn-menuicon-bread-crust-top"></span> </span> <span class="ac-gn-menuicon-bread ac-gn-menuicon-bread-bottom"> <span class="ac-gn-menuicon-bread-crust ac-gn-menuicon-bread-crust-bottom"></span> </span> </label> <a href="#ac-gn-menustate" class="ac-gn-menuanchor ac-gn-menuanchor-open" id="ac-gn-menuanchor-open"> <span class="ac-gn-menuanchor-label">Open Menu</span> </a> <a href="#" class="ac-gn-menuanchor ac-gn-menuanchor-close" id="ac-gn-menuanchor-close"> <span class="ac-gn-menuanchor-label">Close Menu</span> </a> </li> <li class="ac-gn-item ac-gn-apple"> <a class="ac-gn-link ac-gn-link-apple" href="/" id="ac-gn-firstfocus-small"> <span class="ac-gn-link-text">Apple Developer</span> </a> </li> <li class="ac-gn-item ac-gn-bag ac-gn-bag-small" id="ac-gn-bag-small"> <a class="ac-gn-link ac-gn-link-bag" href="/account/"> <span class="ac-gn-link-text">Account</span> <span class="ac-gn-bag-badge"></span> </a> <span class="ac-gn-bagview-caret ac-gn-bagview-caret-large"></span> </li> </ul> <ul class="ac-gn-list"> <li class="ac-gn-item ac-gn-apple"> <a class="ac-gn-link ac-gn-link-apple" href="/" id="ac-gn-firstfocus"> <span class="ac-gn-link-text">Apple Developer</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-discover"> <a class="ac-gn-link" href="/discover/"> <span>Discover</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-design"> <a class="ac-gn-link" href="/design/"> <span>Design</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-develop"> <a class="ac-gn-link" href="/develop/"> <span>Develop</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-distribute"> <a class="ac-gn-link" href="/distribute/"> <span>Distribute</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-support"> <a class="ac-gn-link" href="/support/"> <span>Support</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-account"> <a class="ac-gn-link" href="/account/"> <span>Account</span> </a> </li> <li class="ac-gn-item ac-gn-item-menu ac-gn-search" role="search"> <a id="ac-gn-search-button" class="ac-gn-link ac-gn-link-search" href="/search/" aria-label="Search developer.apple.com"> <span class="ac-gn-search-placeholder" aria-hidden="true">Search</span> </a> </li> </ul> <aside id="ac-gn-searchview" class="ac-gn-searchview" role="search" data-analytics-region="search"> <div class="ac-gn-searchview-content"> <form id="ac-gn-searchform" class="ac-gn-searchform" action="/search/" method="get"> <div class="ac-gn-searchform-wrapper"> <input id="ac-gn-searchform-input" class="ac-gn-searchform-input" type="text" name="q" placeholder="Search" data-placeholder-long="Search for documentation, videos, and more" autocorrect="off" autocapitalize="off" autocomplete="off" spellcheck="false" /> <button id="ac-gn-searchform-submit" class="ac-gn-searchform-submit" type="submit" disabled aria-label="Submit"></button> <button id="ac-gn-searchform-reset" class="ac-gn-searchform-reset" type="reset" disabled aria-label="Clear Search"></button> </div> </form> <aside id="ac-gn-searchresults" class="ac-gn-searchresults" data-string-quicklinks="Quick Links" data-string-suggestions="Suggested Searches" data-string-noresults="Hit enter to search."> </aside> </div> <button id="ac-gn-searchview-close" class="ac-gn-searchview-close" aria-label="Close Search"> <span class="ac-gn-searchview-close-wrapper"> <span class="ac-gn-searchview-close-left"></span> <span class="ac-gn-searchview-close-right"></span> </span> </button> </aside> </div> </nav> <div id="ac-gn-curtain" class="ac-gn-curtain"></div> <div id="ac-gn-placeholder" class="ac-nav-placeholder"></div> <script type="text/javascript" src="/assets/scripts/ac-globalnav.built.js"></script> <div id="top"> <!-- SiteCatalyst code version: H.8. Copyright 1997-2006 Omniture, Inc. --> <script type="text/javascript"> / RSID: */ var s_account="appleglobal,appleusdeveloper" </script> <script type="text/javascript" src="https://www.apple.com/metrics/scripts/s_code_h.js"></script> <script type="text/javascript"> s.pageName= AC && AC.Tracking && AC.Tracking.pageName(); s.channel="www.us.developer" /************ DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/ var s_code=s.t();if(s_code)document.write(s_code)</script> <!-- End SiteCatalyst code version: H.8. --> </div> <ui-view> <!-- Render 'app' component here --> </ui-view> </body> <script src="./scripts/vendor/vendor.bundle.js"></script> <script src="./scripts/app/app.bundle.js"></script> </html>
1
0
3.8k
Nov ’17