iosobjective-cswiftcgimageref

HJImagesToVideo with Swift 2


I am using the source of HJImagesToVideo https://github.com/HarrisonJackson/HJImagesToVideo

When I compiled the sample code provided by him, it is working fine with Xcode 7.2 but when I am using this in my swift project it is not working and showing some errors on

    buffer = [HJImagesToVideo pixelBufferFromCGImage:[array[i] CGImage] size:CGSizeMake(480, 320)]; //line # 212 of HJImagesToVideo.m

    buffer = [HJImagesToVideo crossFadeImage:[array[i] CGImage]
                                                     toImage:[array[i + 1] CGImage]
                                                      atSize:CGSizeMake(480, 320)
                                                   withAlpha:j/framesToFadeCount]; //line # 241 of HJImagesToVideo.m

    UISaveVideoAtPathToSavedPhotosAlbum(tempPath, self, nil, nil);  //line # 150 of 

and the errors are:

/Users/Raza/my apps/appname/app-name/HJImagesToVideo.m:213:64: No known instance method for selector 'CGImage'

and

/Users/Raza/my apps/appname/app-name/HJImagesToVideo.m:213:54: Implicit conversion of Objective-C pointer type 'id' to C pointer type 'CGImageRef' (aka 'struct CGImage *') requires a bridged cast

on line # 213 and 241

and on line # 150 error is:

Users/Raza/my apps/appname/app-name/HJImagesToVideo.m:150:28: Implicit declaration of function 'UISaveVideoAtPathToSavedPhotosAlbum' is invalid in C99

Can anyone can help me to figure out these problem?

Thanks in advance


Solution

  • UISaveVideoAtPathToSavedPhotosAlbum is defined in UIKit. Have you forgot to import UIKit ?