I created my own VPN server(IKEV2) and I successfully run it on my iPhone by the Settings.(see the screenshot):
Then, I want to run the VPN with the same config in the iOS application.
I wrote this config:
let p = NEVPNProtocolIKEv2()
p.useExtendedAuthentication = true
p.serverAddress = "133.37.212.77"
p.remoteIdentifier = "133.37.212.77"
p.authenticationMethod = .none
KeychainWrapper.standard.set("mypassword", forKey: Configuration.KEYCHAIN_PSK_KEY)
let secret = KeychainWrapper.standard.dataRef(forKey: Configuration.KEYCHAIN_PSK_KEY)
p.sharedSecretReference = secret
But when I try to start the connection, nothing happens...
What could be the reason? Why does it run fine with standard iOS OS abilities, but it doesn't from the app?
Thanks!
Related
I am running my emqtt broker by docker image.
I am trying to catch all messages published on my broker and all acknowledged messages. For this purpose I am trying to use emq_web_hook plugin but when I enabled this plugin from dashboard, client disconnects and then unable to connect again to broker. I tried this with default configurations like
web.hook.api.url = http://127.0.0.1
web.hook.rule.client.connected.1 = {"action": "on_client_connected"}
web.hook.rule.client.disconnected.1 = {"action": "on_client_disconnected"}
web.hook.rule.client.subscribe.1 = {"action": "on_client_subscribe"}
web.hook.rule.client.unsubscribe.1 = {"action": "on_client_unsubscribe"}
web.hook.rule.session.created.1 = {"action": "on_session_created"}
web.hook.rule.session.subscribed.1 = {"action": "on_session_subscribed"}
web.hook.rule.session.unsubscribed.1 = {"action": "on_session_unsubscribed"}
web.hook.rule.session.terminated.1 = {"action": "on_session_terminated"}
web.hook.rule.message.publish.1 = {"action": "on_message_publish"}
web.hook.rule.message.delivered.1 = {"action": "on_message_delivered"}
web.hook.rule.message.acked.1 = {"action": "on_message_acked"}
I also changed the url and provide a url of my node server but it also dis not work.My endpoint was never called.
My dashboard is working but I am unable to publish.
What am I doing wrong or are there any steps I missed?
And How can I catch all those events?
I am confused. Documentation is not clear enough.
Thanks
I apologize if this is a duplicate question. I haven't been able to find one and am at a loss. My tests cannot pass because the app doesn't launch. I ran the tests and watched the simulator, and with the normal app (for the unit tests), it will open up and close after the tests have run but my "MyAppUITests" app, it looks like its ready to open and crashes on boot up which is why I'm getting the Application is not running, unable to get Accessibility data. Did you call -launch message.
Console when UI Tests run:
Test Case '-[FizzBuzzUITests.ViewControllerUITests
testTapNumberButtonIncrementsScore]' started.
t = 0.00s Start Test at 2017-04-10 10:44:25.544
t = 0.00s Set Up
t = 0.01s Tap "numberButton" Button
t = 0.01s Wait for app to idle
t = 0.07s Find the "numberButton" Button
t = 0.08s Wait for app to idle
t = 1.13s Find the "numberButton" Button (retry 1)
t = 1.25s Wait for app to idle
t = 2.29s Find the "numberButton" Button (retry 2)
t = 2.41s Wait for app to idle
t = 2.48s Assertion Failure: ViewControllerUITests.swift:25: Application is not running, unable to get Accessibility data. Did you call -launch?
Simulator System Log when launching MyAppUITests: (removed comp name and timestamp for readability)
assertiond[34190]: Submitted job with label: UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]
SpringBoard[34185]: [com.apple.test.MyAppUITests-Runner] Bootstrap complete with label: UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]
XCTRunner[34865]: assertion failed: 16E195 14E269: libxpc.dylib + 64131 [624BAF4F-2E03-34F8-ACBA-970B04637786]: 0x7d
XCTRunner[34865]: Running tests...
XCTRunner[34865]: No configuration specified in environment, checking for the most recent test configuration in TMPDIR (/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272/tmp/)
XCTRunner[34865]: XCTRunner Arguments: (
"/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Bundle/Application/B2EA026D-FB60-4164-9C69-5EDDEC53427F/MyAppUITests-Runner.app/XCTRunner"
)
XCTRunner[34865]: XCTRunner Environment: {
"CFFIXED_USER_HOME" = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272";
CLASSIC = 1;
"CUPS_SERVER" = "/private/tmp/com.apple.launchd.JL1cDBugQn/Listeners";
"DYLD_FALLBACK_FRAMEWORK_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks";
"DYLD_FALLBACK_LIBRARY_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib";
"DYLD_ROOT_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
"DYLD_SHARED_REGION" = avoid;
HOME = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272";
"IOS_SIMULATOR_SYSLOG_SOCKET" = "/private/tmp/com.apple.CoreSimulator.SimDevice.DC33C1C6-5EBB-4156-9F1E-C1844955433D.launchd_sim/syslogsock";
"IPHONE_SHARED_RESOURCES_DIRECTORY" = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data";
"IPHONE_SIMULATOR_CLASS" = D10;
"IPHONE_SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
"IPHONE_TVOUT_EXTENDED_PROPERTIES" = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Library/Application Support/Simulator/extended_display.plist";
PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/local/bin";
"SIMULATOR_CAPABILITIES" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes/iPhone 7.simdevicetype/Contents/Resources/capabilities.plist";
"SIMULATOR_DEVICE_NAME" = "iPhone 7";
"SIMULATOR_EXTENDED_DISPLAY_PROPERTIES" = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Library/Application Support/Simulator/extended_display.plist";
"SIMULATOR_HID_SYSTEM_MANAGER" = "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/Resources/Platforms/iphoneos/SimulatorHID.framework";
"SIMULATOR_HOST_HOME" = "/Users/myuser";
"SIMULATOR_LEGACY_ASSET_SUFFIX" = iphone;
"SIMULATOR_LOG_ROOT" = "/Users/myuser/Library/Logs/CoreSimulator/DC33C1C6-5EBB-4156-9F1E-C1844955433D";
"SIMULATOR_MAINSCREEN_HEIGHT" = 1334;
"SIMULATOR_MAINSCREEN_PITCH" = "326.000000";
"SIMULATOR_MAINSCREEN_SCALE" = "2.000000";
"SIMULATOR_MAINSCREEN_WIDTH" = 750;
"SIMULATOR_MEMORY_WARNINGS" = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/var/run/memory_warning_simulation";
"SIMULATOR_MODEL_IDENTIFIER" = "iPhone9,1";
"SIMULATOR_PLATFORM_RUNTIME_OVERLAY_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/RuntimeOverlay";
"SIMULATOR_PRODUCT_CLASS" = D10;
"SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
"SIMULATOR_RUNTIME_BUILD_VERSION" = 14E269;
"SIMULATOR_RUNTIME_VERSION" = "10.3";
"SIMULATOR_SHARED_RESOURCES_DIRECTORY" = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data";
"SIMULATOR_UDID" = "DC33C1C6-5EBB-4156-9F1E-C1844955433D";
"SIMULATOR_VERSION_INFO" = "CoreSimulator 375.20 - Device: iPhone 7 - Runtime: iOS 10.3 (14E269) - DeviceType: iPhone 7";
"TESTMANAGERD_SIM_SOCK" = "/private/tmp/com.apple.launchd.L8ty9mXSmp/com.apple.testmanagerd.unix-domain.socket";
TMPDIR = "/Users/myuser/Library/Developer/CoreSimulator/Devices/DC33C1C6-5EBB-4156-9F1E-C1844955433D/data/Containers/Data/Application/74576325-9D3A-411C-AC5B-1658CBD46272/tmp";
"XPC_FLAGS" = 0x0;
"XPC_SERVICE_NAME" = "UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]";
"XPC_SIMULATOR_LAUNCHD_NAME" = "com.apple.CoreSimulator.SimDevice.DC33C1C6-5EBB-4156-9F1E-C1844955433D.launchd_sim";
}
SpringBoard[34185]: [KeyboardArbiter] HW kbd: Failed to set (null) as keyboard focus
com.apple.CoreSimulator.SimDevice.DC33C1C6-5EBB-4156-9F1E-C1844955433D.launchd_sim[34164] (UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190][34865]): Service exited with abnormal code: 1
assertiond[34190]: Ignoring assertion request named "Deliver Message" from <BSProcessHandle: 0x7fd178711850; SpringBoard:34185; valid: YES> because process { pid 34865; bundleID (null) } is unknown.
assertiond[34190]: Deleted job with label: UIKitApplication:com.apple.test.MyAppUITests-Runner[0xc278][34190]
UPDATE: Adding Test class code
import XCTest
class ViewControllersUITests: XCTestCase {
func testTapNumberButtonIncrementsScore() {
let app = XCUIApplication()
let numberButton = app.buttons["numberButton"]
numberButton.tap()
let newScore = numberButton.label
XCTAssertEqual(newScore, "1")
}
}
Ahhh, I feel stupid. Looking at another app, I was missing the following code in my test class:
override func setUp() {
super.setUp()
continueAfterFailure = false
XCUIApplication().launch()
}
Most importantly the XCUIApplication().launch() bit.
everyone.
I am trying to override dns resolver settings in my iOS app.
I used NEVPNManager to install a personal vpn and then used onDemandRules to set specific dns servers.
So far my code works for some domains.
Below is my code.
When I put "*.com" in matchDomains, it works perfectly.
But what I want to do is to redirect all dns queries to specific dns server.
I tried empty matchDomains([]) and empty string([""]).
I also tried wildcard expression like ["*"] and ["*.*].
So far I had no success.
It's been a few days and I still can't figure it out.
Can anybody tell me what I am missing here?
Thanks in advance.
let manager = NEVPNManager.sharedManager()
manager.loadFromPreferencesWithCompletionHandler { error in
if let vpnError = error {
print("vpn error in loading preferences : \(vpnError)")
return
}
if manager.protocolConfiguration == nil {
let myIPSec = NEVPNProtocolIPSec()
myIPSec.username = "username"
myIPSec.serverAddress = "server address"
myIPSec.passwordReference = self.getPersistentRef()
myIPSec.authenticationMethod = NEVPNIKEAuthenticationMethod.SharedSecret
myIPSec.sharedSecretReference = self.getPersistentRef()
myIPSec.useExtendedAuthentication = true
manager.protocolConfiguration = myIPSec
manager.localizedDescription = "myDNS"
let evaluationRule = NEEvaluateConnectionRule(matchDomains: ["*.com"], andAction: NEEvaluateConnectionRuleAction.ConnectIfNeeded)
evaluationRule.useDNSServers = ["XXX.XXX.XXX.XXX"]
let onDemandRule = NEOnDemandRuleEvaluateConnection()
onDemandRule.connectionRules = [evaluationRule]
onDemandRule.interfaceTypeMatch = NEOnDemandRuleInterfaceType.Any
manager.onDemandRules = [onDemandRule]
manager.onDemandEnabled = true
manager.enabled = true
manager.saveToPreferencesWithCompletionHandler { error in
if let vpnError = error {
print("vpn error in saving preferences : \(vpnError)")
return
}
}
}
}
I found this is buggy in even the latest iOS (10.3.1) and using NEVPNProtocolIKEv2. One moment it works, the next moment it doesn't want to start a VPN connection because it seems to misinterpret the ondemand rules and gives the error back saying the VPN profile is not enabled. I ended up with configuring the IKEv2 server (Strongswan) to push DNS settings with the "rightdns" option in /etc/ipsec.conf. This gives me the desired result of having the DNS requests redirected to a custom resolver.
I deployed a parse server to AWS Elastic Beanstalk and rewrite my iOS app in AppDelegate.swift. But i only rewrited the ParseMutableClientConfiguration.server so, the APPID and CLIENTKEY is still the same ID and KEYS that are in parse.api.com
It this a correct way to configure my ID and KEYS and server? or do i need to generate a new APPID by myself in this case?
let config = ParseClientConfiguration(block: {
(ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = APP_ID;
ParseMutableClientConfiguration.clientKey = CLIENT_ID;
ParseMutableClientConfiguration.server = "EC2 DNS"
});
Parse.initializeWithConfiguration(config)
Yes this is fine. With swift 3 its done like this.
// Init Parse
let configuration = ParseClientConfiguration {
$0.applicationId = "XXX"
$0.clientKey = "XXX"
$0.server = "XXX"
$0.isLocalDatastoreEnabled = true
}
Parse.initialize(with: configuration)
I am using www.parse.com for an xcode project. Since they do not allow new sign ups, so how do I get my application id for the following code in order to use their services:
let configuration = ParseClientConfiguration {
$0.applicationId = "YOUR_APP_ID"
$0.server = "http://YOUR_PARSE_SERVER:1337/parse"
}
Parse.initializeWithConfiguration(configuration)