Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use PHPhotoLibrary in a mixed code Objective-C/C++ file (a .mm file)?

I am trying to use the PHPhotoLibrary class in an iOS project, but need it in one of my mixed code Objective-C/C++ files. I am getting a build error bc apparently the needed import is not correct. The Apple docs here clearly show that @import Photos is to be used, so in my Build Settings I turned on "Enable Modules (C and Objective-C)" and added @import Photos with my other imports. That however did not fix Xcode's objection to my using @import Photos. The problem is as one of the posts for this SO question here explains, you can only use the @import Photos style of include in .mm files.

(I'm not using Swift, only Objective-C and in a few files mixed Objective-C and C++)

How then can I properly import/include in my .mm file so my PHPhotoLibrary code will build?

like image 715
Alyoshak Avatar asked Dec 15 '22 04:12

Alyoshak


1 Answers

You need to import Photos.framwork

  #import <Photos/Photos.h>  

in your .mm file

like image 181
AppHero2 Avatar answered May 07 '23 07:05

AppHero2