Skip to content

ReferenceError: Can't find variable: JSCocoaController #22

@shankarcabus

Description

@shankarcabus

I'm trying to run this plugin, but it has an error that prevents works.

Sketch[23432]: -[NSArray length] is deprecated . Please call -[NSArray count] instead
Sync Symbol (Sketch Plugin)[23432]: ReferenceError: Can't find variable: JSCocoaController.
Sketch[23432]: Exception: {

That occurs in this function:

function getLayerGroupsByTag(parent, tag) {
  var all = [parent layers];
  // sometimes layers returns an instance of JSCocoaController, I'm not sure why
  if([all class] === JSCocoaController) return [];

  var groups = filterNSArray(all, isGroup),
      tagged = [],
      notTagged = [];

  groups.forEach(function(group) {
    var name = [group name];
    var groupTag = name.match(tagPattern);
    if(groupTag && groupTag[1] === tag) {
      tagged.push(group);
    } else {
      nested = getLayerGroupsByTag(group, tag);
      Array.prototype.push.apply(tagged, nested);
    }
  });

  return tagged;
}

"// sometimes layers returns an instance of JSCocoaController, I'm not sure why"

Do you have any idea why this is always happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions