Kjuly / ALAssetsLibrary-CustomPhotoAlbum

A nice ALAssetsLibrary category for saving images & videos into custom photo album.
http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/
MIT License
405 stars 101 forks source link

Need to import UIKit with iOS 8 #17

Closed scottcarter closed 9 years ago

scottcarter commented 9 years ago

I have successfully used your category in the past and was now attempting to use it with some iOS 8 code (including some Swift).

I ran across the error: "Expected a type" which referenced UIImage in the header file in the code:

I fixed this by adding the following to the header: @import UIKit;

Kjuly commented 9 years ago

Hi @scottcarter , where did the-(void)saveImage:(UIImage *)image used?

And generally, there always exist a line

#import <UIKit/UIKit.h>

in your <project_name>-Prefix.pch file, which will be precompiled, and the lib imported here will be applied globally, u don't need to add @import UIKit;.

scottcarter commented 9 years ago

Hi @Kjuly,

I was referring to the declaration of saveImage in ALAssetsLibrary+CustomPhotoAlbum.h. Where it is used in my code (or even if it is used) doesn't affect the error.

In a pure Swift project in iOS 8, there is no file <project_name>-Prefix.pch

There is a bridging header, but adding the import there doesn't fix the error. It appears that the import must go in ALAssetsLibrary+CustomPhotoAlbum.h to fix the error which I have done with an edit to your header within my project.

Kjuly commented 9 years ago

Thx @scottcarter , code is enhanced now, I will submit to Cocoapod Specs together with issue #15 #16 (if we can fix it).

But if u want a pod version asap, just let me know, I'll help to submit it. Thx :)

sarperdag commented 9 years ago

A pod version is greatly appreciated on my side too! Thanks guys!!

Kjuly commented 9 years ago

Sure, let me add it. :)

Kjuly commented 9 years ago

Hi @sarperdag v1.2.0 pushed. :)