Can I put a live photo into the iOS Simulator? - objective-c

I want to create an app to display a live photo. But I don't have an iPhone 6S. Is there a opportunity to put a live photo into the iOS Simulator?
Thanks!

The interface has improved greatly since this was originally asked/answered. It's now very easy to do this.
Go to Photos App and find the LivePhoto(s) you want to put on your (simulated) device.
Select the photo(s), go to File-> Export-> Export Unmodified Original For n Photo....
The saved files will be exported to your Desktop. There will be two files for each LivePhoto.
Drag both files (for each live photo) onto the simulator device.
LivePhotos are created and automatically placed in your simulated device's photo gallery.
Original Answer:
This is how I did it. Using the PhotosUI interface, my app asks for a LivePhoto. Using the PHAsset it gives me, I save a local copy of the .mov file and the high quality .png image. These two files are the "LivePhoto".
In Xcode, I go to Devices with my phone connected, select the app, click on the settings cog icon at the bottom and select download container. Go to Finder, right click on the .xcappdata file I just downloaded, select ShowPackageContents and the files are where I wrote them. I drag them into the app (Xcode is open - drop them on the navigator pane on the left), and they will be added to the app's bundle.

It is possible to put live photo into simulator, You need a video file, and an image file (because a Live photo is a combination of these two). And then using Photos Framework, you can save the live photo in gallery
PHPhotoLibrary.shared().performChanges({
let request = PHAssetCreationRequest.forAsset()
request.addResource(with: .photo, fileURL: imageUrl, options: nil)
request.addResource(with: .pairedVideo, fileURL: videoUrl, options: nil)
}) { (success, error) in
print(success)
print(error?.localizedDescription ?? "error")
}

The only way I've found is pretty clumsy: Get a live photo into your iCloud photo stream, then connect your simulator to your iCloud account. The live photos will then be available in your simulator's photo library.
As you might expect, the "get a live photo..." step can be tricky--you may need a friend with an iPhone 6s/6s+ to iMessage you one. Although some services like Facebook and Google Photos support Live Photo viewing in-app, they don't appear to support downloading them to your Photo Library while retaining their live-ness.

Related

iOS app files that the user can download from the app

The idea is that i will create a file in the app and store some data in it.
I want for the end user to be able to download that file from the iOS device to his mac/pc.
Is this somehow possible? Where should i put the file for the user to be able to download it via itunes?
Here is good tutorial you can use:
Tutorial
It is important to know, that in iOS, when your user needs to create file, you do not need to care where to save it.
Another possibility for you might be to avoid saving data as file. For example, if your data is picture:
UIImage send to email

How to open the apple app store internally using a modal segue

I am currently making an app that recommends other apps to download on the apple app store. I assumed that the only way for users to download these linked apps was to call the iTunes URL of the particular app -> the apple app store would then open pushing the original calling app into the background -> then the user would press the download button here as per normal.
Then I was playing with the app "App Hero" and they do something I thought wasn't possible. You can actually download another app to your device without ever leaving the "App Hero" application. I thought this was impossible due to sandboxing. They have a modal segue to what appears to be an embedded app store where you can commence installation of another app. This "embedded" app store doesn't have the usual UITabBar running along the bottom but everything else is basically the same.
Does anyone have any idea how they would have achieved this? It doesn't appear to be a UIWebView, perhaps I am wrong. And is this against any of the apple regulations?
*This is no way an advertisement for "App Hero". I am genuinely impressed/confused how they are able to do this and would love this functionality in my own app if it is allowed.
The class you are looking for is called SKStoreProductViewController. Docs here.

Loading pictures to gallery

I need some advice. In my application people can upload images. I will store the images on a server. I want to make a photo gallery where you can see all uploaded images. Every user has a account. And it will download all uploaded images.
The point is that when you uploaded 1 image it has to download 1 image. But when you upload 10 or more the app will have to download all images and cache the images to your device.
What is the best way to download all images and keep the app running without getting stuck. Also what is the best way to cache all images.
If you want to create some photo gallery apps, check out this open source sample.
Created by Michael Waterfall, which includes photo gallery from images stored on server or locally.
You can modify the code as per your project requirements. And it is easy to handle the images.

Which one is the folder containing iPhone/iPad images

I'm developing an application and I'd like to list the images present in the "Documents" directory of my application (to load images using iTunes) and I'd like to list the images and photos taken by the Camera as well.
And I do know about UIImagePickerController, but I don't need that. I want to integrate the photos and the loaded application images in the same place. But I can't find any information about where can I find all the device camera photos.
Thanks in advance
You can access all the photos stored in the photo library using the Assets Library Framework. Check out the documentation here:
https://developer.apple.com/library/ios/#documentation/AssetsLibrary/Reference/AssetsLibraryFramework/_index.html
Specifically, you want to use ALAssetsLibrary's enumerateGroupsWithTypes:usingBlock:failureBlock: to enumerate the ALAssetsGroupSavedPhotos type, and enumerate the photos in that group with ALAssetGroup's enumerateAssetsUsingBlock:.
Some links with sample code:
http://www.icodeblog.com/2010/07/08/asset-libraries-and-blocks-in-ios-4/
http://www.fiveminutes.eu/accessing-photo-library-using-assets-library-framework-on-iphone/

Add badge icon overlay to Finder icons and folders?

When we open Dropbox folder, we can see icon on the left bottom of the folder.
I am developing an application in which i also want the same behavior. If folder is syncing then it will show sync icon and for other operation it will show other icon. The marked files/folder when viewed in Finder must be shown with a custom icon. But when they are selected for preview ( using spacebar) they must show their original icon ( i.e the blue icon for folder etc) .
Starting with Yosemite (10.10), there is now an officially supported (and thus Mac App Store compatible) method for displaying sync status badges in Finder icons in the form of Finder Sync extensions.
Dropbox has developed a NSPlugin for showing icon badges on each folder/file. As you would know, NSPlugins for Finder were deprecated by Apple starting with Snow Leopard. I think Dropbox worked around it with a hack - that reenabled plugin support. I don't think Apple would have liked that. Apple wants third party apps to only provide services support, since they don't want any third party code in Finder's process, but services are underwhelming.
In addition to the Finder Sync Extension mentioned in other answers, badges (and other metadata) on files can additionally be accomplished via the File Provider API:
File Provider
An extension other apps use to access files and folders managed by your app and synced with a remote storage.
https://developer.apple.com/documentation/fileprovider
Specifically, the NSFileProviderItemDecorating class:
Badge
The system displays the badge image on top of the item’s icon. It only displays the first Badge image.
FolderBadge
Only available on folder items. The system embosses the image over the folder icon. It only displays the first FolderBadge image.
This can be achieved by creating new Finder Sync Extension. Find more information here: https://stackoverflow.com/a/43183393