cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in learning how media industry leaders use Dropbox Replay? Register for our webinar here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Problems when migrating from API v1 to v2

Problems when migrating from API v1 to v2

Mr_K
Explorer | Level 3
Go to solution

When migrating my Objective C project for iOS from Dropbox API v1 to v2

I am changing my source code, replacing old

 

#import <DropboxSDK/DropboxSDK.h>

to new

#import <ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.h>

 

But when compiling the project I get an error:

 

'ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.h' file not found

 

Also in "Pods > Products" section in Xcode both "ObjectiveDropboxOfficial.framework" and "Pods_BASIC.framework" frameworks are marked in red color.

 

 

What settings are missing or what I am doing wrong?

 

26 Replies 26

Mr_K
Explorer | Level 3
Go to solution

Also I found this:

 

in BASIC project target in Build Phases there are two Run Script Phases:

[CP] Embed Pods Frameworks

[CP] Copy Pods Resources

 

and in SB project target these Build Phases are absent.

 

Maybe this can be the reason of error?

As far as I understand these Build Phases are created when installing pod, taking into account Podfile settings.

But in Podfile I have only one target: 'BASIC', target 'SB' is commented out, because if I also add 'SB' as a target:

 

platform :ios, '9.0'

target 'BASIC' do
use_frameworks!

pod 'ObjectiveDropboxOfficial'
end

target 'SB' do
use_frameworks!

pod 'ObjectiveDropboxOfficial'
end

 

I get these errors when installing pod:

 

$ pod install

Analyzing dependencies

[!] Unable to find host target(s) for SB. Please add the host targets for the embedded targets to the Podfile.

Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:

- Framework

- App Extension

- Watch OS 1 Extension

- Messages Extension (except when used with a Messages Application)

 

So, maybe this is the reason of error? But how to install pod for 'SB' target?

Stephen C.14
Dropbox Staff
Go to solution

If you uncomment `target 'SB' do` in your Podfile, and then you run `pod install`, even with the CocoaPods errors, the .xcworkspace file builds for me for target `SB`.

 

Can you confirm this?

Mr_K
Explorer | Level 3
Go to solution

This Podfile:

 

target 'BASIC' do
use_frameworks!
pod 'ObjectiveDropboxOfficial'
end

target 'SB' do
end

 

And this podfile:

 

target 'BASIC' do
use_frameworks!
pod 'ObjectiveDropboxOfficial'
end

target 'SB' do
use_frameworks!
pod 'ObjectiveDropboxOfficial'
end

 

Both give the same pod install output:

 

Analyzing dependencies
[!] Unable to find host target(s) for SB. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)

 

And give these two Xcode compilation errors:

 

/Users/kibernetik/Мои программы/BASIC copy/SB/ViewController.h:7:9: 'ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.h' file not found

 

Error: unable to read module map contents from 'Target Support Files/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.modulemap': Error Domain=NSCocoaErrorDomain Code=260 "The file “ObjectiveDropboxOfficial.modulemap” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/kibernetik/Мои программы/BASIC copy/Pods/Target Support Files/ObjectiveDropboxOfficial/ObjectiveDropboxOfficial.modulemap, NSUnderlyingError=0x7fd04bcfb3b0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

 

Of course Xcode was reloaded each time.

Stephen C.14
Dropbox Staff
Go to solution

In your Podfile, please delete `use_frameworks!` for target `'SB'` only. Then things should work.

 

(it doesn't really make sense to link a framework to a library).

Mr_K
Explorer | Level 3
Go to solution

I also have tried this variant. When my Podfile is:

 

platform :ios, '9.0'
target 'BASIC' do
use_frameworks!
pod 'ObjectiveDropboxOfficial'
end
target 'SB' do
pod 'ObjectiveDropboxOfficial'
end

 

I get the same pod install warning and the same two errors.

Actually I get 'file no found' error even prior to compiling: Xcode editor immediately marks this code line as erroneous just after the project is loaded.

Stephen C.14
Dropbox Staff
Go to solution

I still get the pod warnings as well, but everything builds correctly for me.

 

Please ensure that you close Xcode before calling `pod install` and that you open the `.xcworkspace` file and not the `.xcodeproj` file.

 

Please also do a full a rebuild (cmd+option+shift+k) after `pod install`.

 

If you have done all of these things, then please repost your updated project here, as I am not seeing the same issues that you are.

Mr_K
Explorer | Level 3
Go to solution

All issues are the same.

This is the latest version of test project: https://yadi.sk/d/6W373tQ23K8Uyg

Thank you!

Stephen C.14
Dropbox Staff
Go to solution

This project builds fine for me after running `pod install` and opening the `.xcworkspace` file.

 

Please ensure that you have Xcode Version 8.3.3+ installed.

Mr_K
Explorer | Level 3
Go to solution

Can you please share back the project that compiles?

Stephen C.14
Dropbox Staff
Go to solution

Same project as the one you just uploaded (the second one).

 

Which version of Xcode are you using? Please download the latest one, otherwise things might not compile.

Need more support?