Is it possible to upload data from custom keyboard to the web service? I mean that an app works on custom keyboard and using it for operations belong to web service like registering user to a website or logging in etc.
Yes, but the user must manually switch on "Allow Full Access" in iOS's Settings app (in the same place where the keyboard is installed in the first place). Your keyboard extension must also request open access by setting the RequestsOpenAccess key to true under NSExtensionAttributes in your extension's info plist.
See more about this option under "Designing for User Trust" on Apple's keyboard extension webpage: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
Related
I'm trying to access the last photo from the user's camera roll within an iOS keyboard extension. I have allowed full access to the keyboard and allowed access to the Photo Library. But every time I try to run PHImageManager.default().requestImage... the keyboard is terminated...
Is it not possible to use PHImageManager in a keyboard extension?
According to App Extension Programming Guide it should be possible.
If you request open access by setting this key’s value to YES, your keyboard gains the following capabilities, each with a concomitant responsibility in terms of user trust:
Access to Location Services, the Address Book database, and the Camera Roll, each requiring user permission on first access
only allowing full access in the info.plist file is not enough, also the user has to allow full access in the keyboards settings.
On your device go to Settings -> General -> Keyboard -> Keyboards -> %NAME_OF_YOUR_KEYBOARD% and turn on Allow Full Access!
But I'm still facing problems here: although i have added a NSPhotoLibraryUsageDescription to my extensions info.plist
my keyboard terminates with following message:
[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
I've been googling on how to gracefully handle when user refuse to enable push notification service and location service that my app requires. I found out that Apple's human interface guideline prohibits developers from exiting app programatically and it should be left with users. But I don't want user to use my app without those services enabled since they are neccessary. How do accomplish that without violating any guidelines Apple laid out?
Well, I would just display a static view that explains why those services are required and how the user can enable them - best by offering a button that will redirect to the settings (Swift 3 code):
// in Button handler code:
if let appSettings = URL(string: UIApplicationOpenSettingsURLString) {
UIApplication.shared.openURL(appSettings)
}
A lot of apps implement a "pre-request" dialog, if the user accepts the request on the pre-request then display the actual permission request dialog as they're more likely to accept. If they decline your pre-request dialog, tell them again why you need the permissions or certain features won't function and try again. I haven't heard of Apple having any issues with this approach.
If they've already declined the permission request then you will need to alert them the required permissions haven't been granted and which features are now disabled, offer a dialog button to direct them to settings and display how to enable the permissions.
To open settings from your app use the below code
Swift 3
UIApplication.shared.openURL(URL(string:UIApplicationOpenSettingsURLString)!)
Swift 2.x
UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationOpenSettingsURLString)!)
Objective-C
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]
Update
Just realised you want to limit functionality of your app should user not have required services enabled. The best way is simply to push a view controller that displays an image and/or label stating that certain features aren't enabled and therefore the app can't function. You could detail the steps to enable required services with a button directing them to settings as per above. Again, I haven't seen Apple take issue with this as many apps implement this method should they lack for example GPS.
I am new to iOS. Is it possible to show a custom view or dialog in place of the default iOS location permission dialog?
No, this dialog is presented by the operating system and you cannot modify it. It is an important part of privacy management that the dialog is presented in a consistent way for all apps and that apps cannot modify the permission process.
You can display a custom view or alert prior to requesting permissions that explains what is happening and the need to click "allow" on the alert that is about to be presented
Direct Answer is it's not possible
explanation :
Only option is set description string by using Cocoa Keys(The keys associated with the Cocoa touch environments)
Add one of these key to
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
Info.plist and set it's value to whatever which describe the purpose of getting location
ex:
MyApp picks you up from where you are. To book airport rides, choose “Allow” so the app can find your location.
Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and which accesses the user’s location information, must statically declare the intent to do so. Include the NSLocationAlwaysUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access the user’s location information without a corresponding purpose string, your app exits.
If you looking for localization for that message
Link
I'm implementing a custom keyboard for iOS8. I have a containing app that sets a few keyboard specific values to NSUserDefaults so that the keyboard can read from them.
This works fine, however I must set requestsOpenAccess to yes to get this working on device.
This seems like overkill to me, I only want to read a few values from the containing app. I don't want any of the other features of the networked keyboard.
Does any one know if there is a way to read values set in the containing app without requesting open access?
There is no way to share content between host app and keyboard extension without requestOpenAccess.
You have to enabled a shared container for host app and keyboard extension, and use
[[NSUserDefaults alloc] initWithSuiteName:];
to access a shared NSUserDefaults.
Yes it is overkill, but this is the only way.
Is it allowed, by Apple, to have the Signout function from the Settings page?
I just want the app to be as clean as possible so we don't have any Signout function from within the app itself =)
As you might notice in the docs, settings bundles are "dumb UI" -- that is, your bundle provides to the Settings app a list of NSUserDefaults keys for storing your app's preferences, along with a high-level specification for how they're to be presented in the UI... but there's no way to provide executable code for directly responding to changes made in the Settings app, drawing custom controls, etc.
So you can't just put a button in Settings that signs the user out of your service when tapped -- you can, as JoePasq suggests, add a switch or other control to the effect of "sign out on next launch". That switch can set a value in NSUserDefaults, which your app can then read when launched and react to accordingly.
From what I know: Sure. The HIG says
Preferences in the Settings app are of the “set once and rarely change” type.
You need to decide how to implement it. I would use a switch titled “Sign out on next use”.