54th Day As An iOS Developer With No Experience
FRIDAY - November 13, 2015.
I will just share for today the question that I have submitted on Stackoverflow and the only answer that I got. So this is my exact question:
I've been curious this morning aboutPHAsset
. I used to deal withALAsset
last month. I downloaded an iOS project from Apple website that usesALAsset
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 usingALAsset
?). My boss is so good in iOS and I saw his codes, he is usingPHAsset
.
So what is the difference betweenALAsset
andPHAsset
? I also saw a thread in Apple/iOS forum thatPHAsset
is new andALAsset
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 thatPHAsset
andALAsset
are both fromNSObject
.
It's true that I've read some part of Apple's documentation to find the answer in my question above. So according to the answer that I got on SO (stackoverflow), I am correct. PHAsset is the new ALAsset. Check out the answer below:
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.
So that's it, this post is all about the discussion of that two types of assets in iOS. I'm pretty much more familiar now with the PHAsset.
Post a Comment