Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24009] Hyperloop: iOS - Protocols are not generated properly

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-03-03T11:41:21.000+0000
Affected Version/sHyperloop 2.0.0
Fix Version/sHyperloop 2.0.1
ComponentsHyperloop, iOS
Labelsn/a
ReporterHans Knöchel
AssigneeJan Vennemann
Created2016-10-10T16:41:11.000+0000
Updated2017-03-15T15:56:26.000+0000

Description

I am currently testing the Facebook iOS SDK with Hyperloop and trying to bridge the presentMessengerDialog method to Hyperloop. Here is the JS-call: app.js
var fb = require('facebook');

var win = Ti.UI.createWindow({
  backgroundColor: "#fff"
});

var btn = Ti.UI.createButton({
  title: "Open Messenger Dialog"
});

btn.addEventListener("click", function() {
    fb.presentMessengerDialog({
           title: "Appcelerator Titanium rocks!", // The title of the link
           description: "Shared from my Titanium application", // The description of the link
           link: "https://appcelerator.com", // The link you want to share
           referal: "ti_app", // The referal to be added as a suffix to your link
           placeID: "my_id", // The ID for a place to tag with this content
           to: [] // List of IDs for taggable people to tag with this content
       });
});

win.add(btn);
win.open();
and the Hyperloop implementation is: facebook.js
var FBSDKShareLinkContent = require("FBSDKShareKit/FBSDKShareLinkContent"),
	FBSDKMessageDialog = require("FBSDKShareKit/FBSDKMessageDialog"),
	NSURL = require("Foundation/NSURL");

exports.presentMessengerDialog = function(params) {
   var content = new FBSDKShareLinkContent();
      
   content.setContentURL(NSURL.URLWithString(params["link"]));
   content.setContentDescription(params["description"]);
   content.setContentTitle(params["title"]);
   content.setPlaceID(params["placeID"]);
   content.setRef(params["referal"]);
   content.setPeopleIDs(params["to"]);
   
   FBSDKMessageDialog.showWithContentDelegate(content, null); // TODO: Add delegate
};
The FBSDKShareLinkContent class is an NSObject and implements the FBSDKSharingContent protocol. The build succeeds, but as soon as we click on the button, the method fails because setContentURL is undefined. A look into the generated metabase confirms that all properties from the FBSDKSharingContent are not generated, the ones from FBSDKShareLinkContent are. I am linking the frameworks locally (in /src and appc.js), so it might be something related to locally embedded frameworks only.

Comments

  1. Hans Knöchel 2016-10-10

    Assigning to [~jvennemann] as we talked about it already. It is no general protocol problem and happens to both local embedded frameworks and cocoapods deps. Jan suggested that the metabase forwards the delegates incorrectly for the properties, which makes sense. Scheduling to 2.0.1 for now.
  2. Hans Knöchel 2017-02-02

    [~jvennemann] Could this be a duplicate of TIMOB-24198?
  3. Jan Vennemann 2017-02-07

    Actually this is a bug were the properties and methods from a protocol weren't merged into a class. To avoid unnecessary merging a function would check if a protocol was already implemented by a parent class. It could happen that this function would check against the base class instead of it's parent and then falsely assume a parent already implemented the protocol, thus skipping the merge process. PR (master): https://github.com/appcelerator/hyperloop.next/pull/121 PR (2_0_X): https://github.com/appcelerator/hyperloop.next/pull/122
  4. Harry Bryant 2017-03-15

    Verified as fixed, with Hyperloop 2.0.1, ShareLinkContent now shares correctly. Tested On: iPhone 7 10.2 Device Mac OS Sierra (10.12.2) Ti SDK: 6.0.2.GA Hyperloop Module (2.0.1) CocoaPods (1.2.0) Appc NPM: 4.2.9-1 App CLI: 6.1.0 Xcode 8.2.1 Node v4.6.0 *Closing ticket.*

JSON Source