TooTallNate / NodObjC

The Node.js ⇆ Objective-C bridge

Home Page:http://tootallnate.github.io/NodObjC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no output from NSDateFormatter stringFromDate

devsnek opened this issue · comments

commented

my code is as follows:

const $ = require('nodobjc');

$.import('Foundation');

const pool = $.NSAutoreleasePool('alloc')('init');

const dateFormatter = $.NSDateFormatter('alloc')('init');
dateFormatter.dateStyle = $.NSDateFormatterMediumStyle;
dateFormatter.timeStyle = $.NSDateFormatterMediumStyle;
dateFormatter.locale = $.NSLocale('alloc')('initWithLocaleIdentifier', $('en_US'));

const date = $(new Date());

console.log(dateFormatter.methods());

$.NSLog($("%@"), dateFormatter('stringFromDate', date));

pool('release');

the $.NSLog never seems to run, did i do something stupid?

commented
$.NSDateFormatter(
  'localizedStringFromDate', date,
  'dateStyle', $.NSDateFormatterMediumStyle,
  'timeStyle', $.NSDateFormatterMediumStyle,
)

solved my problem