Swift 'Could not build Obj-C module 'BranchInvite'

这一生的挚爱 提交于 2019-12-24 01:55:35

问题


I've been following the instructions for implementing this SDK: https://github.com/BranchMetrics/Branch-iOS-Invite-SDK... below is what I have in my Podfile:

platform :ios, '8.0'
use_frameworks!

target 'My-App' do
pod 'BranchInvite'
end

And here is the error I'm getting...

I've done a lot of troubleshooting to try and figure out the problem, looked at past issues of this reporsitory of this sort, and for some reason I cannot get "BranchWelcomeViewController" (nor BranchInvite) to be recognized/imported. Any idea what I'm doing wrong here? Do I need to populate my bridging-header?

PS: I'm using Xcode 7, Swift 2, OS X 10.10.5, and the latest version of Cocoapods.

Thanks


回答1:


@SamYoungNY, after debugging using the project you sent over, the best approach using Swift appears to be the following:

Podfile

pod "Branch"
pod "BranchInvite"

your app's bridging header

#import <Branch/Branch.h>
#import <BranchInvite/BranchInvite.h>
#import <BranchInvite/BranchInviteViewController.h>
#import <BranchInvite/BranchInviteTextContactProvider.h>
#import <BranchInvite/BranchInviteEmailContactProvider.h>
#import <BranchInvite/BranchWelcomeView.h>
#import <BranchInvite/BranchWelcomeViewController.h>
#import <BranchInvite/BranchWelcomeControllerDelegate.h>
#import <BranchInvite/BranchWelcomeDefaultView.h>

Then be sure to use your project's .xcworkspace file if you weren't previously. Please let us know if this doesn't work. I'm happy to continue to debug with the actual project you sent over.




回答2:


I received a lot of help from @st.derrick on this question, and there was something wonky with my version control but in the end I got it working with something I found in the branch.io documentation, the answer is in this link:

https://support.branch.io/support/discussions/topics/6000008855




回答3:


I can't comment yet but here's the archived text from that thread SamYoungNY linked to.

If you're running into an issue where you know that you've imported >Branch, but Xcode can't seem to find it, we may know the answer. You're >probably seeing a screenshot like the one below:

(Picture not archived)

This likely means that you are importing Branch as a "folder reference" >and not a "group".

  1. Delete the Branch folder from your project

  2. Make sure Branch is no longer in your project's folder (in the file >system, not Xcode)

  3. Re-import Branch and be sure to select "Create Groups" (see screenshot >below)



来源:https://stackoverflow.com/questions/33218117/swift-could-not-build-obj-c-module-branchinvite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!