I am implementing both iOS and Mac applications. I implemented Hand Off feature in both applications. When I test implementation it works well when:
start on iOS app and continue on iOS app
start on iOS app and continue on Mac app
But it doesn't work when I start on Mac app and want to continue on iOS app. Logically, the problem is when I create userActivity and becomeCurrent on Mac app. But the code for iOS and Mac is the same, so I don't know where the problem is.
// Create userActivity
_userActivity = [[NSUserActivity alloc] initWithActivityType:#"com.myapp.image"];
_userActivity.title = #"Image";
_userActivity.supportsContinuationStreams = YES;
_userActivity.delegate = self;
_userActivity.userInfo = #{
#"Key" : #"information from the other device",
#"URL" : #"http://www.apple.com"
};
[_userActivity becomeCurrent];
Thanks!
I submitted a bug report with ID: 41374510 with title: Handoff doesn't work from MacOS to iOS.
I tested it with the same code in reverse from iOS to MacOS and that worked great so I am assuming that it is a Apple's bug.
Related
I am trying to run this sample project from Apple that uses ARGeoTrackingConfiguration: https://developer.apple.com/documentation/arkit/content_anchors/tracking_geographic_locations_in_ar
This sample app is supposed to show an AR camera feed in the top part of the screen, and a map view in the lower part. However, I am not seeing the camera feed, it's just black.
I suspect this is something that changed in iOS 15.4, since my colleague was able to run the app successfully on a phone with iOS 15.3.1.
Some other details:
I am seeing this issue on an iPhone 12 Pro Max and an iPhone 13 mini.
Both these devices can support geotracking and are connected to the internet.
I am in a location that has geotracking support, according to these docs: https://developer.apple.com/documentation/arkit/argeotrackingconfiguration
I updated to iOS 15.4.1 but the issue is still occurring.
I tried updating to the iOS 15.5 beta 1 and the issue is still occurring.
Has anyone else noticed this issue? Am I doing something wrong? Is there a workaround?
I filed a radar ticket as well, just in case.
EDIT: I filed a TSI request for this issue, and I got back a response saying that there is no workaround for the issue. However, it looks like the bug has been fixed in iOS 15.5 beta 2.
// Class originalClass = NSClassFromString(#"NSXPCDecoder");
// Class swizzledClass = NSClassFromString(#"SwizzledDecoder");
// SEL originalSelector = #selector(_validateAllowedClass:forKey:allowingInvocations:);
// SEL swizzledSelector = #selector(__validateAllowedClass:forKey:allowingInvocations:);
#interface SwizzledDecoder : NSObject
- (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3;
#end
#implementation SwizzledDecoder
- (void)__validateAllowedClass:(Class)arg1 forKey:(id)arg2 allowingInvocations:(bool)arg3 {
if ([arg2 isEqualToString: #"collaborationData"]) {
return;
}
return [self __validateAllowedClass: arg1 forKey: arg2 allowingInvocations: arg3];
}
#end
https://developer.apple.com/forums/thread/703735?answerId=711909022#711909022
I could think of a few options to "fix" this using Private (Apple) APIs. This approach is not super terrible and at least would unblock you from testing on a 15.4.x device (I confirmed this works on Xcode 13.3.1 and iOS 15.4.1).
As far as whether or not Apple would approve #YOLO #FIDLAR code like this in an App Store review? I can't help you there.
The real fix (we can hope for) is the next version of Xcode ships with an SDK that builds and compiles with a retroactive fix for 15.4.x.
This issue has been fixed in iOS 15.5
In one particular scenario I am taking the user to passcode settings page . below is the code used for this -
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=PASSCODE"]];
After upgrading to iOS 10 beta version I am no longer taken to settings passcode page instead it terminates the app .
Can anyone please help me with this . Thanks in advance .
No way yet.
About 1 month before iOS 10 beta 1 was released, my app got a rejection because of opening a Preference.app URL. The app review team gave me a phone call to explain it: It's not permitted right now for the reason: Using private API. Only opening current app's setting page(UIApplicationOpenSettingsURLString) is allowed.
So it really makes sense now why they rejected me. Because no one could open system setting since iOS 10.
Updated answer at 8 Dec, 2016:
Using Private API (Don't submit the app with these code to the App Store):
#interface PrivateApi_LSApplicationWorkspace
- (BOOL)openSensitiveURL:(id)arg1 withOptions:(id)arg2;
#end
PrivateApi_LSApplicationWorkspace* _workspace;
_workspace = [NSClassFromString(#"LSApplicationWorkspace") new];
BOOL result = (BOOL)[_workspace openSensitiveURL:[NSURL URLWithString:#"Prefs:root=YOURSETTINGURLHERE"] withOptions:nil];
The prefs scheme has changed on iOS 10, you can use this :
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL.init(string:"App-Prefs:root= PASSCODE")!, options: [UIApplicationOpenURLOptionUniversalLinksOnly:true], completionHandler:{(success: Bool?) -> Void in}})
} else {
// Fallback on earlier versions
UIApplication.shared.openURL(URL.init(string:"Prefs:root= PASSCODE")!)
}
On iOS 10 you can use openURL:options:completionHandler: instead;
Also you can see this article(openURL Deprecated in iOS 10) for more details.
Hi I am automating the native ios application on ios . I already automated android native app but for launching the appium server on mac from c# code running on windows I need to know how to setup the Desired capabilities for ios platform.
Please find the below peace of code for c# language:
DesiredCapabilities capabilities = new DesiredCapabilities();
TestCapabilities testCapabilities = new TestCapabilities();
testCapabilities.App = "";
testCapabilities.AutoWebView = true;
testCapabilities.AutomationName = "";
testCapabilities.BrowserName = String.Empty; // Leave empty otherwise you test on browsers
testCapabilities.DeviceName = "Needed if testing on IOS on a specific device. This will be the UDID";
testCapabilities.Platform = TestCapabilities.DevicePlatform.IOS; // Or Android
testCapabilities.PlatformVersion = String.Empty; // Not really needed
testCapabilities.AssignAppiumCapabilities(ref capabilities);
driver = new AppiumDriver(testServerAddress, capabilities, INIT_TIMEOUT_SEC);
driver.Manage().Timeouts().ImplicitlyWait(IMPLICIT_TIMEOUT_SEC);
To run Appium test on iOS simulator/real device, Mac hardware is needed and to run test on real device, team id from apple developer account is also needed. More details here.
Connect the iPhone to MacOS via cable or connect both iPhone and Mac computer to same wireless network (WiFi).
C# code for initialising appium iOS driver to run test on real device:
//Initialise driver options
AppiumOptions capabilities = new AppiumOptions();
//Declare capabilities
capabilities.AddAdditionalCapability(MobileCapabilityType.PlatformName, "iOS");
capabilities.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "13.2"); //put real device iOS version
capabilities.AddAdditionalCapability(MobileCapabilityType.DeviceName, "iPhone X"; //put real device name
capabilities.AddAdditionalCapability(MobileCapabilityType.AutomationName, "XCUITest");
if (appInstalled)
{
//if app is installed and don't want to re-install, use below capability
capabilities.AddAdditionalCapability(IOSMobileCapabilityType.BundleId, "<app-bundle-id>");
}
else
{
//(re)installs app
capabilities.AddAdditionalCapability(IOSMobileCapabilityType.AppName, "<name-of-test-app>");
capabilities.AddAdditionalCapability(MobileCapabilityType.App, "<absolute-path-to-test-app.app>");
}
capabilities.AddAdditionalCapability(MobileCapabilityType.Udid, "<real-device-Udid>");
capabilities.AddAdditionalCapability("xcodeOrgId", "<team-id>");
capabilities.AddAdditionalCapability("xcodeSigningId","iPhone Developer");
//Initialise iOS driver
var driver = new IOSDriver<IMobileElement<AppiumWebElement>>(capabilities);
in my project i call this function: (Facebook SDK for iOS version v4.1.0)
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
gameRequestContent.message = #"Choi thu nhe, hay lam day";
gameRequestContent.title = #"Monkey Junior";
gameRequestContent.to = friends;
dialog = [FBSDKGameRequestDialog showWithContent:gameRequestContent delegate:(id)self];
Image:
Our app is in landscape and the Facebook friend invite dialog is in portrait and the buttons Send and Cancel are located outside the screen.
Please help me.
This is a known issue with the FB SDK for iOS being tracked here.
This issue is seen in iOS 7.x so if it is blocking you then you can maybe at least test your functionality (if feasible) in iOS 8.x till the fix is released.
I have an AppleScript that I setup to close the iOS simulator after X amount of time. I know that in objective-c using the Cocoa framework for a Mac app, I would just easily do:
NSString *scriptSource = #"tell application \"iOS Simulator\" to quit";
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:scriptSource];
NSError *error = nil;
[script executeAndReturnError:&error];
Obviously I can't do this in iOS. Is there anything that will run my AppleScript in iOS? Or does anyone know of any workarounds or ways to do this?
Or, is there a way to close the iOS Simulator from within the app using natively Objective-C, another scripting language, or add it to the build phase?
No.
You can't run AppleScript on an iOS device.
And there is no way to quit the iOS simulator from an iOS app.
Sorry.