I'm looking to make a custom keyboard for iOS that accesses a user's camera roll. Is this possible? I've done a bit of research but it doesn't seem like a custom keyboard extension can access the camera roll.
A custom keyboard extension can access the camera roll, provided the user has already given full access; all the same code that works in a normal app should work in a keyboard extension as well. Per the documentation:
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
I believe that Riffsy has a feature where you can save to and recover GIFs from the camera roll.
Related
Hey folks I’m having trouble wrapping my head around the correct way to handle camera and photo permissions in iOS 14 and what the appropriate flow is. It feels like I’ve overlooked something simple though not sure what exactly.
For context, the user is not prompted with a request for camera or photos permission until they’ve tapped the respective button for the first time. The app includes a custom photo picker that displays available photos to select based on previous photo associations (i.e. a photo can only belong to one product at a time and wouldn’t show as “available” in the custom picker unless it wasn’t associated with a product).
If the user taps the camera button, accepts the permission request, takes a photo and taps “Use Photo”, the UIImagePickerController is dismissed and an alert is presented that asks the user to Select Photos..., Allow Access to All Photos, or Don't Allow. If the user chooses to allow access to all photos there is no problem, the photo is saved using PhotoKit APIs and the UI updated to showcase the thumbnail of the photo just taken. Everything works as expected.
If the user chooses to select certain photos, a PHPickerViewController is presented and does not include the photo just taken with the camera since it has yet to be saved. This makes sense though leaves me to wonder how do I save the image and allow the user who chooses limited photo access to select that newly taken photo? Perhaps this isn’t possible.
There are additional hiccups I’m seeing with the flow such that if the user then taps “Done” to dismiss the PHPickerViewController without making any selections after electing limited access, the app is able to save the image taken from the camera using PhotoKit APIs and the UI updated to showcase the thumbnail (this seems incorrect though I may be misunderstanding something simple).
In the same run of the app, if the user taps the photos button, they are presented with the custom picker and logging shows a fetch count of 0 photos available to the user. This makes sense since there were no selections made. However, on the next app run, if the user taps the photo button, they are presented with the alert to Select More Photos... or Keep Current Selection. If they elect to add to the photo selection, they are presented with a PHPickerViewController that shows the photo previously taken with the camera as a user selection and a fetch count of 1 for available photos. Additionally, with limited access mode, attempts to generate thumbnails have produced errors in the Xcode console indicating that an operation is not permitted or a failure to decode an asset. I've seen the following in the console: [Thumbnails] Could not open PLPositionalImageTable...
It feels like I’m missing something basic in this process of taking, saving, and using photos (even a limited selection of them) for iOS 14. Does anyone have experience with this or a resource beyond recent WWDC videos that may shed light on what I’m missing? Appreciate the help in advance.
Also fwiw I would love to rely on PHPickerViewController rather than the custom picker however unless I’m missing something, PHPickerViewController doesn’t allow us to provide a subset of photos to display and only that subset even if the subset is limited by the user selection in limited access mode. If I’m misguided I’d appreciate direction there as well. Thanks all!
The issue is not clear how you are using a custom image picker. and how you are capturing the image. If you capturing the image using a native image picker as it looks like. Picker delegate will give image without saving in photos. But it looks like you are trying to save the image first in photos and trying to access it from there. alternatively, You can use the image once you consume the provided image.
Photos permissions are prompted when the user is trying to access photos the first time. and photo selection is asked when the user trying to access the photo the first time after the app launch.
If you have case when user is selected "Limited selection" access. You can check for current photos library selection and alert user based on selection.
switch PHPhotoLibrary.authorizationStatus() {
case .notDetermined:
PHPhotoLibrary.requestAuthorization { [weak self] status in
switch status {
case .authorized:
self?.initPhotoLibrary()
case .limited:
// Alert user to select all photos
default:
self?.handleDeniedAlbumsAuthorization()
}
}
case .authorized:
self.initPhotoLibrary()
case .limited:
// Alert user to select all photos
case .restricted: fallthrough
case .denied:
handleDeniedAlbumsAuthorization()
}
There are additional hiccups
This is based on custom image picker logic, this should not be the case for native image picker.
Check apple documentation for PHPicker:
https://developer.apple.com/documentation/photokit/delivering_a_great_privacy_experience_in_your_photos_app
if AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) == AVAuthorizationStatus.authorized {
// if de user accept before
}
else
{
AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: { (response :Bool) -> Void in
if response == true {
// User accept the permission
}
else {
// User declined the permission
}
});
}
I have uploaded My App to Appstore but they rejected with this reason (AR Camera View Image Detection).
Application Functionality
- detect image and play video
- image are store in AR Resource asset
From Apple
- we were still unable to locate a method of obtaining the AR markers in your app.
so can you help me for that and what is the AR Marker?.
Apple is very strict with regard to apps that use marker recognition, because Apple wants to make sure the end user has an optimal experience. If AR experience requires a marker image, it is important to inform the user how to and from where to obtain the marker image.
There are two main things to to do:
It's important to include the marker image when submitting your app
to the store.
Within your app's UI you have to inform the user what
marker image to use and how to obtain the marker.
Please note: From my experience Apple will also reject apps that force the user to purchase a physical product in order to unlock content. Any paywall/purchase requirement would have to be through an in-app purchase
There is two type marker and markless . markless mean some animation image will show the camera . marker means if you target something means you will show the marker image inside the target image .
Is there an easy way to make in iOS Google Street View GMSPanormaView's camera follow the device's orientation via data from its motion sensors?
If not, has anyone already done it and can share a code snippet that takes data from CoreMotion, maybe manipulates it to create GMSPanoramaCamera, and passes it to the GMSPanoramaView with animateToCamera:animationDuration:?
Any relevant Android code would also be useful.
Upon checking the Maps SDK for iOS:Internal: Street View, there is no built-in function/implementation for the device orientation/ gyroscope sensor.
According to Ziem's answer you can try implement this by yourself(create function). He also give pointers to study the following:
Set the camera orientation point of view
Animate the camera movements
Reference:
Blog
Github
Using a site they have successfully create a function that will let you browse the Google streetview panoramas with your smartphone/tablet like you were inside it, just by moving your phone like a window to the world.
I have a game where users can take a screen shot and it will save it to a custom album named after the game. When I try and do this, iOS asks the user if the App can have access to their location information, if they say no, then the screen shot is not saved in the custom album, but rather the default album.
Why is it asking permission to use location information? I'm just taking a screen shot. It has nothing to do with the camera. I'm just copying the opengl surface and making a UIImage out of it.
This is how I'm saving the UIImage:
- (void)writeImageToSavedPhotosAlbum:(CGImageRef)imageRef orientation:(ALAssetOrientation)orientation completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)completionBlock;
Is location information being put into the screen shot? If so, can I disable that so this warning doesn't come up? My game has no need for location information and I'd hate for users to think I'm tracking them.
This seems like a crazy warning since it's completely factually wrong.
As shown in the following link,
http://developer.apple.com/library/ios/#Documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html
This method will fail with error
ALAssetsLibraryAccessGloballyDeniedError if the user has not enabled
Location Services (in Settings > General).
However, we have found that there is not location permission request in iOS 6. Maybe iOS 6 has other privacy control on Photos. So you don't need to asking location permission. Our solution is check the [[UIDevice currentDevice]systemVersion] and only save to custom album while iOS >= 6.
is there a way to setup an image as a device wallpaper? Originally I want to download an image, save it somewhere in a picture roll and set it up as a wallpaper programmatically.
google doesn't give me any answer on how could it be done.
Unfortunately this API is not exposed to developers. There is also no URL scheme exposed for developers to launch the Photos app.
You're only option is to display a prompt that tells the user to manually go to the Photos application to set their wallpaper, and indicate how they would set the wallpaper there.