Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24910] Hyperloops iOS - Allow protocols declared within other classes

GitHub Issuen/a
TypeBug
PriorityCritical
StatusResolved
ResolutionWon't Fix
Resolution Date2019-09-17T15:10:50.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsHyperloop, iOS
Labelsdelegate, engTriage, hyperloop
ReporterRodolfo Perottoni
AssigneeUnknown
Created2016-09-22T23:22:33.000+0000
Updated2019-12-02T23:06:28.000+0000

Description

I'm trying to use the Braintree SDK with Hyperloop and found an issue while trying to create a protocol bridge.
Caught exception: JSParseError: invalid protocol specified "BTDropInViewControllerDelegate"
It happenes because of this:
var delegate = Hyperloop.defineClass('delegate', 'NSObject', ['BTDropInViewControllerDelegate']);

//rest of code doesn't matter.

module.exports = delegate;
I'm requiring this file in a controller and the error above pops up when building the project. I think this issue is happening because the *BTDropInViewControllerDelegate* protocol is not declared in a file with the same name - and I guess that's what's Hyperloop expects. This protocol is being defined inside the file *BTDropInViewController*. I'm importing Braintree with Pods.
platform :ios, '8.0'
target 'loopmodules-braintree' do
	pod 'Braintree', '~> 3.9'
end

Comments

  1. Hans Knöchel 2016-09-23

    The delegate is not available in recent Braintree SDK-versions and has been replaced with
       - (void)dropInViewController:(BTDropInViewController *)viewController didSucceedWithTokenization:(BTPaymentMethodNonce *)paymentMethodNonce;
       
  2. Hans Knöchel 2016-09-24

    Resolving for now. Probably you used the v3 docs and the v4 source that changed the selector as described above. If not, let us know.
  3. Rodolfo Perottoni 2016-09-29

    Hey @Hans. As you've said, I'm using the v3.
       install! 'cocoapods',
                :integrate_targets => false
       
       platform :ios, '8.0'
       target 'loopmodules-braintree' do
       	pod 'Braintree', '~> 3.9'
       end
       
    v4 is not working because of another problem - the documentation tells me to use something that's not included in the pods, but this is not a problem you should be concerned about. As for what you said above, the delegate I'm using does have that method I'm declaring. You can check that here: http://cocoadocs.org/docsets/Braintree/3.9.7/Protocols/BTDropInViewControllerDelegate.html
  4. Rodolfo Perottoni 2016-10-09

    waiting...
  5. Rodolfo Perottoni 2016-10-21

    This ticket is valid and I've found the cause of the issue. There's nothing to do with different versions of the Braintree SDK. Hyperloop is not being able to find the *BTDropInViewControllerDelegate* protocol because it is defined within the class *BTDropInViewController*. As of now Hyperloop looks for a file with the exact name of the protocol you're trying to support. There should be a way to specify where a protocol is being defined in case it "doesn't have its own file".
  6. paul@appwapp.com 2017-07-05

    Have there been any changes to Hyperloop to support protocols declared inside other files? I am currently experiencing this issue using Google VR SDK in Hyperloop, and the Hyperloop documentation has not discussed this issue in any sort of useful detail.
  7. Hans Knöchel 2017-11-29

    [Hyperloop 3.0.1](https://github.com/appcelerator-modules/hyperloop-builds/releases/tag/v3.0.1) may solve this by being more smart regarding framework imports. Will validate next week after the 7.0.0 release.

JSON Source