DZNPhotoPickerController with multiple targets in Swift
Closed this issue · 4 comments
Hi everyone
I want to use DZNPhotoPickerController in an blank Swift project with an Apple Watch Extension.
After I executed pod install
and added bridging headers to the Project, Xcode raises "AFNetworking.h" file not found
in DZNPhotoServiceClient.m
. Do you have any idea why Xcode won't build the project when using DZNPhotoPickerController in a project with many targets?
My Podfile looks like:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'DZNPhotoPickerController'
The files MyApp-iOS-Bridging-Header.h
and MayApp-iOSTests-Bridging-Header.h
only contain:
#import <DZNPhotoPickerController/DZNPhotoPickerController.h>
The file MyApp-iOS WatchKit Extension-Bridging-Header.h
is empty (otherwise Xcode says 'DZNPhotoPickerController/DZNPhotoPickerController.h' file not found.
).
Thanks very much and best regards
Your Podfile configuration is incomplete.
You must install DZNPhotoPickerController
exclusively for you app target.
target 'my_app_target', :exclusive => true do
pod 'DZNPhotoPickerController'
end
😉
Hi dzenbot.
Thank you very much for your quick reply and help!
I modified my Podfile as you said, but still ran into the same error.
After I changed the file DZNPhotoServiceClient.h
from
#import "AFNetworking.h"
#import "DZNPhotoServiceClientProtocol.h"
#import "DZNPhotoPickerControllerConstants.h"
to
#import <AFNetworking/AFNetworking.h>
#import "DZNPhotoServiceClientProtocol.h"
#import "DZNPhotoPickerControllerConstants.h"
it seems to finally work for me. I'm quite new to CocoaPods and Projects with Bridging Headers, so I'm not really sure about this issue..
Thanks a lot and best regards
Oh that's because you're using the use_frameworks!
flag, so AFNetworking
needed to be imported as a framework instead.
just replace AFNetworking.h with AFNetworking/AFNetworking.h