Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23667] iOS: Hyperloop - Calling [object class] fails on device

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-10-11T04:55:59.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsHyperloop, iOS, Tooling
Labelsn/a
ReporterChee Kiat Ng
AssigneeHans Knöchel
Created2016-07-21T03:22:58.000+0000
Updated2016-10-11T04:56:21.000+0000

Description

Sample that call the NSObject class method class (e.g. UICollectionView) are not working on iOS device but do work well on simulator.

Steps to reproduce

1. Clone hyperloop-examples 2. Install hyperloop 1.2.3 3. *appc ti build -p ios -T device* 4. on device, choose CollectionView

Expected Result

See lots of boxes of different colors

Actual Result

This error appears:
[ERROR] Script Error {
[ERROR]     column = 2291;
[ERROR]     line = 1;
[ERROR]     message = "o[\"class\"] is not a function. (In 'o[\"class\"]()', 'o[\"class\"]' is undefined)";
[ERROR]     sourceURL = "file:///var/containers/Bundle/Application/A2B1F11F-E7F7-4AD1-9CAA-996F3A1E2718/Hyperloop_Sample.app/alloy/controllers/collectionview.js";
[ERROR] }

Attachments

FileDateSize
Hyperloop Error.txt2016-10-05T15:10:09.000+00005855

Comments

  1. Josh Longton 2016-07-21

    I am able to reproduce this issue too. *ENV:*
       
Mac OSX El Capitan 10.11.6
       Studio: 4.7.0.201607130543
       
Ti SDK: 5.4.0.v20160720132422
       
Xcode 7.3.1 
       
Appc NPM: 4.2.7
       Appc CLI: 5.4.0-33 
       Node v4.4.4 
       
  2. Hans Knöchel 2016-07-25

    The class-method [object class] is mapped to the string-representation of the class instead of using object.class(). While [~jvennemann] is still investigating why it works in the Simulator, the above way is the proper solution for now. Example: Native:
       [collectionView registerClassForCell:[UICollectionViewCell class] withReuseIdentifier:@"Cell"];
       
    Hyperloop:
       collectionView.registerClassForCellWithReuseIdentifier("UICollectionViewCell", "Cell");
       
    I updated the hyperloop-examples repo to reflect this change and we might also want to update the docs for this behavior.
  3. Hans Knöchel 2016-07-28

    Marking as fixed, since the hyperloop-examples have been updated using the correct syntax. @QE: Please verify the fix by testing the collection-view example on device.
  4. Harry Bryant 2016-10-05

    Get the following error when trying to run the hyperloop example app on device (iOS10 / 9 ) _Please see the attached Error File._ Tested On: iPhone 6 Plus 10.0.2 Device & Simulator iPhone 5S 9.3.5 Device Mac OSX El Capitan 10.11.6 Hyperloop Module (1.2.7, 2.0.0) Ti SDK: 6.0.0.v20161004202820 Appc Studio: 4.8.0.201609292239 Appc NPM: 4.2.8-7 App CLI: 6.0.0-56 Xcode 8.0 Node v4.4.7 *Reopening Ticket.*
  5. Hans Knöchel 2016-10-06

    [~htbryant] The error relates to TIMOB-23971 as I already commented there. Please resolve / close this one again.

JSON Source