Comments (4)
Do you have some code that I can reproduce the issue with?
from nodobjc.
See https://github.com/bernhard-42/node-cocoa-http
Without patch, calling via curl localhost:8080 -d '{"a":42}'
$ coffee app.coffee
[Class: PostConnection1]
server listening to port 8080
listening ...
expectsRequestBodyFromMethod
supportsMethod
processBodyData
/Users/bernhard/Development/node-cocoa-http/cocoa-http.coffee:124
self.ivar("request")("appendData", postDataChunk);
^
TypeError: object is not a function
at /Users/bernhard/Development/node-cocoa-http/cocoa-http.coffee:91:7
at /Users/bernhard/Development/node-cocoa-http/node_modules/NodObjC/lib/core.js:253:31
at /Users/bernhard/Development/node-cocoa-http/node_modules/NodObjC/node_modules/ffi/lib/callback.js:52:23
With patch:
$ coffee app.coffee
[Class: PostConnection1]
server listening to port 8080
listening ...
expectsRequestBodyFromMethod
supportsMethod
processBodyData
httpResponseForMethod
{ method: POST,
url: /,
headers:
{ 'User-Agent': 'curl/7.37.1',
Accept: '*/*',
Host: 'localhost:8080',
'Content-Length': '8',
'Content-Type': 'application/x-www-form-urlencoded' },
body: '{"a":42}',
httpVersion: '1.1' }
from nodobjc.
Any idea whether this fix is correct or whether the issue sits deepr in import.js? - thanks
from nodobjc.
@bernhard-42 I think the issue is deeper.
@TooTallNate code that reproduces a similar issue, generating the wrapped value. In this case type
is undefined completely.
var $ = require('nodobjc');
$.framework('Foundation');
$.framework('Cocoa');
var pool = $.NSAutoreleasePool('alloc')('init');
var result = $.CGWindowListCopyWindowInfo($.kCGWindowListOptionAll, $.kCGNullWindowID);
var windowList = $.CFBridgingRelease(result);
var aWindow = windowList('objectAtIndex', 0);
console.log(aWindow.ancestors());
// ['__NSCFDictionary','NSMutableDictionary','NSDictionary','NSObject' ]
console.log(aWindow.toString())
/* example:
{
kCGWindowAlpha = 1;
kCGWindowBounds = {
Height = 1440;
Width = 2560;
X = 1440;
Y = "-540";
};
kCGWindowIsOnscreen = 1;
kCGWindowLayer = 20;
kCGWindowMemoryUsage = 1008;
kCGWindowNumber = 14764;
kCGWindowOwnerName = Dock;
kCGWindowOwnerPID = 354;
kCGWindowSharingState = 1;
kCGWindowStoreType = 1;
}
*/
pool('drain');
Trying to access a property
aWindow('kCGWindowOwnerName');
produces the following error:
2015-08-13 17:59:23.262 node[85901:3004028] -[__NSCFDictionary kCGWindowOwnerName]: unrecognized selector sent to instance 0x101351770
/node_modules/nodobjc/lib/class.js:193
else throw e;
^
-[__NSCFDictionary kCGWindowOwnerName]: unrecognized selector sent to instance 0x101351770
at ID.module.exports.Class.msgSend (/node_modules/nodobjc/lib/class.js:192:45)
at rtn (/node_modules/nodobjc/lib/core.js:375:47)
at app.js:27:15
at /node_modules/nodobjc/lib/core.js:256:31
at /node_modules/nodobjc/node_modules/ffi/lib/callback.js:66:25
at ForeignFunction.proxy (/node_modules/nodobjc/node_modules/ffi/lib/_foreign_function.js:59:14)
at unwrapper (/node_modules/nodobjc/lib/core.js:301:31)
at ID.module.exports.Class.msgSend (/node_modules/nodobjc/lib/class.js:189:34)
at rtn (/node_modules/nodobjc/lib/core.js:3
using ivar
produces:
aWindow.ivar('kCGWindowOwnerName');
/node_modules/nodobjc/lib/class.js:193
else throw e;
^
TypeError: Cannot read property 'type' of null
at Object.wrapValue (/node_modules/nodobjc/lib/core.js:181:24)
at ID.module.exports.ID.ivar (/node_modules/nodobjc/lib/id.js:74:19)
at app.js:27:19
at /node_modules/nodobjc/lib/core.js:256:31
at /node_modules/nodobjc/node_modules/ffi/lib/callback.js:66:25
at ForeignFunction.proxy (/node_modules/nodobjc/node_modules/ffi/lib/_foreign_function.js:59:14)
at unwrapper (/node_modules/nodobjc/lib/core.js:301:31)
at ID.module.exports.Class.msgSend (/node_modules/nodobjc/lib/class.js:189:34)
at rtn (/node_modules/nodobjc/lib/core.js:375:47)
at tock [as _onTimeout] (app.js:60:14)
For sanity I enumerated over the NSObject
to verify the keys, and everything looked good.
var keys = aWindow('keyEnumerator');
var key;
while(key = keys('nextObject')){
console.log(key);
}
/*
kCGWindowLayer
kCGWindowName
kCGWindowMemoryUsage
kCGWindowIsOnscreen
kCGWindowSharingState
kCGWindowOwnerPID
kCGWindowNumber
kCGWindowOwnerName
kCGWindowStoreType
kCGWindowBounds
kCGWindowAlpha
*/
Worth noting: numIvars does not exist in this code
from nodobjc.
Related Issues (20)
- Doing an in-app purchase in Electron app for the Mac App Store HOT 1
- [Question] Are there any simple ways to get a binary data of NSData or NSInlineData? HOT 4
- Do I need some release procedure?
- Unable install nodobjc in electron project
- Please update with fixed ffi "callback has been garbage collected" (ffi-napi maybe?) HOT 1
- Activating an application - may be a bug
- can't install nodobjc HOT 2
- Dynamic Linking Error HOT 3
- Question: Any help regarding usage of the NSSharingService (composeEmail)
- Error in electron 3.0.0 HOT 5
- TypeError: error setting argument 2 - writeInt64: Number/String 64-bit value required HOT 2
- Unable to call CoreTextFunctions
- $.import() is not importing nested frameworks
- .EKEventStore
- node event loop blocked whilst menus are active HOT 3
- crashed in electron 4.2.5 HOT 1
- is support Node V12 and electron 5+ HOT 3
- install error
- Question: how to create a NSWindow? HOT 1
- No native build was found for platform=darwin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodobjc.