Is it possible to edit the metadata for an MPMediaItem? - ios

I would like to make an iOS app that simplifies the process of organizing a users iTunes Library by allowing them to update metadata for their music files on the go.
Are you able to edit the metadata of files that are stored on an iPhone in the default music library or is access to this restricted by the sandbox? If you are able to do it how is it done?

You can't do it. The only thing that can modify the music library on a phone is iTunes (either the iOS version or the Mac version.)

Related

How safe is to store files into the document directory?

I am writing an iOS app in Swift and Xcode where I allow users to download some files from a server and to store them into the iPhone's document directory.
How safe is it to do so?
Is it possible for a user to access one of these files from outside the app, for example by connecting their phone to a computer, and move them around or share them? If a user has a jailbroken iPhone, could he get a way to access the downloaded files in other ways other than the one I allow within my app?
And if so, should I encrypt my files when I download them?
For jailbroken iPhone i think yes it's possible to access apps directories.
For normal iPhone I'm pretty sure other apps can't access it as all third-party apps are “sandboxed"
https://support.apple.com/en-gb/guide/security/sec15bfe098e/web#:~:text=Sandboxing,information%20stored%20by%20other%20apps.
And no idea about connecting their phone to a computer.

Swift - how to access all pdf files on device

I am trying to build an app that will allow users to see all pdf files that are on the device (in some kind of a list with a preview) [Regardless of which app it belongs to on the device, all should be shown]. Is there anyway to achieve this?
Sorry but this is not possible on an iOS device because of a feature called sandboxing. Apple does not allow an app to access the sandbox of another app. Each app sits inside a sandbox of its own. This is iOS's security feature. There is no way to go around this feature.
Reference - About App Sandbox

IOS - Storing Audio and Videos outside App Sandbox

I am fairly new to IOS App Development. I have an app which plays audio and videos that are present in the App Package. Now I want my app to play audios and videos that are outside the App Package altogether i.e. if I uninstall my app the media files should not be deleted.
I have heard that all the apps can access media files that are added through ITunes. So I want to know the path of this folder(Kindly excuse me if you find my terminology vague. As I said I am fairly new to IOS App Development).
You cannot store the files outside app sandbox. Where as we can save image/video files to photos app
using, UIImageWriteToSavedPhotosAlbum/UISaveVideoAtPathToSavedPhotosAlbum
Please check developer documentation

Specific constraints of iOS sandboxing

I would like read access to the files in the iPhones music directory:
~/Media/iTunes_Control/Music/F**/*.{M4A,MP3}
1) I can't seem to figure out from the docs whether iOS apps are sandboxed such that I would or would not have this permission.
2) Is it necessary to ask for read or write permissions to directories outside the iOS App sandbox ? Only write permissions ? How does one do this, or is it just up to the discretion of the team that reviews the App for app store release ?
3) I have found a lot of information in the apple docs on sandboxing of OS X apps but not of iOS apps. Is there a similar sandboxing/entitlements process for iOS as for OS X apps ? Any useful links I should read ?
Update: as accepted answer says below, 1,2, and 3 are impossible, however it is possible to obtain a copy of a file in the media library, which is in some sense equivalent to having read access to the original - because of course the digital information is identical. This question contains code that does that:
Application crashed while importing songs from Ipod library in Iphone for iOs 5.0
You will not have permission to read/write outside your application.
You will not have permission to read/write outside your application.
You will not have permission to read/write outside your application.
You can use the Media Player framework to access information about the user's library, but nothing using the filesystem.
Sandboxing on iOS is done for you, there is no need to set that up.
You can not write files outside your applications sandbox.
I have not attempted to access music stored by the iPod app, but there is access to media types. It functions much like access photos.
Here is the link to the Apple docs for MPMediaPickerController.

Upload file from iPhone media library, in 2012

I'm about to launch a service where one of the feature is to upload files with an 'upload' button on a website. Some years ago, I made some program for iPhone, and I remember that it was impossible to upload an MP3 from the library, because each app is in its sandbox, though I was able to upload MP3 placed in the sandbox itself.
There is an old post on SO about the impossibility to upload from the library to a website:
A html5 web app for mobile safari to upload images from the Photos.app?
Is possible as of may 2012 for an iPhone/iPad to be prompted into the music library when clicking on an html upload button?
I don't think things will evolve in your way on iPhone.
I assume your service will not be in native objective-c.
look at the features of phonegap to see what interactions are currently possible :
http://docs.phonegap.com/en/1.8.0/index.html
You can probably develop a dedicated app to extract the music file using the Media Player framework and send them to your service, but I barely doubt it can pass the apple verification team.
Apple will not allow you to do this. Although it may be possible using private APIs or perhaps the Media Player framework, it will not be accepted by Apple.

Resources