Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: imported declaration 'TVICameraSourceOptionsBuilderBlock' could not be mapped to 'CameraSourceOptionsBuilder.Block' #72

Closed
tszymala opened this issue Jan 3, 2020 · 21 comments
Assignees

Comments

@tszymala
Copy link

tszymala commented Jan 3, 2020

Description

The following error gets thrown when integrating TwilioVideo using Carthage or CocoaPods and BUCK.

<unknown>:0: error: imported declaration 'TVICameraSourceOptionsBuilderBlock' could not be mapped to 'CameraSourceOptionsBuilder.Block'

This could be a similar issue

Expected Behavior

Not get the error.

Actual Behavior

Error gets generated '<unknown>:0: error: imported declaration 'TVICameraSourceOptionsBuilderBlock' could not be mapped to 'CameraSourceOptionsBuilder.Block''

Reproduces How Often

First build after cleaning the build folder and removing derived data.

Versions

Video iOS SDK

3.1.0 via Carthage or CocoaPods

Xcode 11.3
Swift 5.1.3

@piyushtank piyushtank self-assigned this Jan 6, 2020
@piyushtank
Copy link
Contributor

Hi @tszymala,

Since the problem is not reproducible with Xcode build using CocoaPods or manual installation, I suspect it is a problem with BUCK. I do not have BUCK setup installed but an easy test would be to eliminate TwilioVideo from the equation by reproducing the problem using NS_SWIFT_NAME for a function in an objective C header file and use it in your Swift project and use buck to see if it complains.

typedef void (^TVICameraSourceOptionsBuilderBlock)(TVICameraSourceOptionsBuilder * _Nonnull builder)
NS_SWIFT_NAME(CameraSourceOptionsBuilder.Block);

NS_SWIFT_NAME(CameraSourceOptions)
@interface TVICameraSourceOptions : NSObject
+ (nonnull instancetype)optionsWithBlock:(nonnull TVICameraSourceOptionsBuilderBlock)block;
@end

Best,
Piyush

@tszymala
Copy link
Author

Hi Piyush,

Thanks for the suggestion i will try it shortly.

Also it turns out that everything works when i downgraded to using XCode 10.3. It seems that this only affects XCode 11.x.

-Tom

@tszymala
Copy link
Author

I cannot reproduce this error using an Objc file as you described. It work on XCode 11.3.

Odd that for some reason its just that namespaced block that its not happy with in the TwilioVideo SDK

@AdiAyyakad
Copy link

AdiAyyakad commented Jan 15, 2020

I've run into this quite a few times - we use Cocoapods to install TwilioVideo. Sometimes just cleaning the build folder seems to fix it Hmm I seem to have jinxed myself - it doesn't seem to go away now

@AdiAyyakad
Copy link

I'm using:
Xcode 11.3
TwilioVideo 3.1.0
Cocoapods 1.7.5

@AdiAyyakad
Copy link

AdiAyyakad commented Jan 15, 2020

Looks like this is a problem specifically with TwilioVideo 3.1.0. I just downgraded to v3.0.1 and it works @piyushtank

@piyushtank
Copy link
Contributor

Thanks @tszymala @AdiAyyakad.

I pulled latest quickstart, used TwilioVideo 3.1.0 with cocoa pods version 1.7.5, tried running on Xcode 11.3.1, it worked as expected. I am trying to find a way to reproduce the problem in our lab so that we can fix it.

@AdiAyyakad The method signature or the NS_SWIFT_NAME for CameraSourceOptionsBuilder hasn't changed between v3.0.1 and v3.1.0.

@AdiAyyakad
Copy link

AdiAyyakad commented Jan 15, 2020

Weird now it works again. I have no idea why or what changed 🤷‍♂ Now it's failing our CI. I will revert to 3.0.1 anyways

@tszymala
Copy link
Author

@AdiAyyakad I have not tried with 3.0.1 but will give it a shot.

@piyushtank I'm experiencing the problem when using BUCK. The fastest way to reproduce it is to clone the AirBnB Buck Sample project.

  • Runmake install_buck
  • Add TwilioVideo SDK to the podfile
  • Add the following to Pods/BUCK
prebuilt_apple_framework(
    name = "TwilioVideo",
    framework = "TwilioVideo/Build/iOS/TwilioVideo.framework",
    preferred_linkage = "shared",
    visibility = ["PUBLIC"],
)
  • add the following to Libraries/ASwiftModule/BUCK
first_party_library(
    name = "ASwiftModule",
    deps = [
        "//Pods:TwilioVideo",
    ],
)
  • You should now be able to import TwilioVideo in Libraries/ASwiftModule/Sources/MySwiftClass.swift
  • Might need to call something in the SDK.
  • Running make project will generate an Xcode project.
  • Building it will generate the error after deleting derived data and cleaning build folder.

@ceaglest
Copy link
Contributor

ceaglest commented Feb 3, 2020

Hi @tszymala and @AdiAyyakad,

Thank you for your feedback on this issue and help in reproducing the problem with 3.1.0.

Unfortunately we can't commit to officially supporting Buck at this time. If there is another way to reproduce the error with a vanilla CocoaPods, Carthage or manual integration then we would be happy to take another look.

Best,
Chris

@AdiAyyakad
Copy link

AdiAyyakad commented Feb 4, 2020

I am using vanilla Cocoapods, not Buck. This issue happens on fresh installs, new projects, etc. It's fairly consistent for me, but every once in a while things start building. I'm assuming it's some Xcode bug that's being expressed via this but I have no idea how

@ceaglest
Copy link
Contributor

ceaglest commented Feb 4, 2020

Thanks for mentioning that @AdiAyyakad. If the issue occurs with vanilla CocoaPods we can try to reproduce with the CocoaPods and Xcode versions that you provided.

@LyndseyScott
Copy link

LyndseyScott commented Feb 4, 2020

@ceaglest Receiving the same warning (not an error for me) with CocoaPods 1.8.4, TwilioVideo 3.1.0, Xcode Version 11.3.1:

<unknown>:0: warning: imported declaration 'TVICameraSourceOptionsBuilderBlock' could not be mapped to 'CameraSourceOptionsBuilder.Block'

@ceaglest
Copy link
Contributor

ceaglest commented Feb 4, 2020

Thanks for the report @LyndseyScott.

While we investigate, I just want to note that there is a similar issue with Xcode 11 mentioned on the Apple developer forums.

@raylillywhite
Copy link

raylillywhite commented Feb 15, 2020

Is there a workaround for this issue? Do we just downgrade to 3.0.1? (edit: Downgrading to 3.0.1 got it working for me)

@AdiAyyakad
Copy link

That's what I had to do 🤷‍♂

@ceaglest
Copy link
Contributor

My apologies, but I'm not aware of any workaround at the moment.

@paynerc
Copy link
Contributor

paynerc commented Feb 20, 2020

Is this issue still occurring with 3.2.1 or 3.2.0? I am working on reproducing and solving this issue.

@paynerc
Copy link
Contributor

paynerc commented Feb 20, 2020

I have figured out the issue and will be working on getting 3.2.2 out as soon as practicable which resolves this issue.

Sincere apologies for the time it took to get the issue reproduced and solved. I have added an automated testing scenario which will catch any future issues with NS_SWIFT_NAME mappings before a release is shipped.

@paynerc paynerc closed this as completed Feb 20, 2020
@paynerc paynerc reopened this Feb 20, 2020
@paynerc
Copy link
Contributor

paynerc commented Feb 20, 2020

This issue got automatically closed when I merged the PR that referenced this issue. 🙄

I will leave this issue open until 3.2.2 is released.

@paynerc
Copy link
Contributor

paynerc commented Feb 21, 2020

3.2.2 has been released, which addresses this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants