I've been curious this morning about PHAsset
. I used to deal with ALAsset
last month. I downloaded an iOS project from Apple website that uses ALAsset
to make a simple iOS Photos-like app, and I modified it to add more features to be more iOS Photos-like app. And then my boss handled my project and told the whole office that I should be trained and he has to re-write the whole project because my codes are mostly outdated (probably because of using ALAsset
?). My boss is so good in iOS and I saw his codes, he is using PHAsset
.
So what is the difference between ALAsset
and PHAsset
? I also saw a thread in Apple/iOS forum that PHAsset
is new and ALAsset
is old.
Also, I would like to know which is better between the two, and which of these two is easier to use when it comes to writing meta data to the image.
I am new to iOS (2 months), and I can see that PHAsset
and ALAsset
are both from NSObject
.
As you can see from the reference documentation for the two classes they are from two different frameworks.
PHAsset
is from the newer Photos framework (added in iOS 8.0).
ALAsset
is from the original AssetsLibrary framework.
You should use the newer framework if your app's Deployment Target is iOS 8.0 or newer. Only use the older AssetsLibrary framework if your app has a need to support iOS 7 or earlier.
The question of which is easier is irrelevant in this case. Use the newer one if possible. Apple always encourages the use of the newest frameworks, libraries, OS, hardware, etc.
You will also notice that the entire AssetsLibrary framework has been deprecated. This means it is obsolete. It still functions but its use is discouraged in favor of the newer library.