Alyoshak
Alyoshak

Reputation: 2746

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?

Upvotes: 4

Views: 3029

Answers (1)

AppHero2
AppHero2

Reputation: 687

You need to import Photos.framwork

  #import <Photos/Photos.h>  

in your .mm file

Upvotes: 14

Related Questions