tidev / node-ios-device

Queries connected iOS devices and installs apps
Other
122 stars 37 forks source link

What is the process for adding a property recovered from the iOS device? #8

Closed youanden closed 9 years ago

youanden commented 9 years ago
youanden@Georgiys-MBP$ npm -v
2.14.2
youanden@Georgiys-MBP$ node -v
v0.12.7

Preface: I've worked with libimobiledevice before and went through a very painful polling technique using the binaries and command-line to check for new devices, attempt to pair, wait for the user to pair, then use ideviceinfo to get the raw properties, then parse, etc. This library looks like a god-send.

I've edited ios-device.cpp to add a property found in mobiledevice.h : InternationalMobileEquipmentIdentity, and tried to enter the folder and do one of the following: npm install node-gyp rebuild npm rebuild or from the project directory, npm rebuild.

Do I just have to edit the ios-device.cpp or is there some other location I need to edit before the return object has the added property?

cb1kenobi commented 9 years ago

@youanden Simply cd into the node-ios-device directory and run:

npm build .

That will build the module for your current node version. With the above command you don't have to install node-gyp. node-gyp actually comes with npm.

If you change Node.js versions, you'll have to recompile. If you run make, it will build node-ios-device for all versions of Node.js and io.js. We have to actively maintain this as new Node versions come out. Sort of a pain.

With your change to ios-device.cpp and the new binary built in the out directory, you just need to run node test/test-device.js to see your connected device's info which will include your new property. You can also run node test/test-trackDevices.js and connect/disconect your device to watch it in realtime.

I should point out that node-ios-device uses MobileDevice which will list devices that are not physically connected but have enabled iTunes wifi sync. Think of it as a feature.

youanden commented 9 years ago

@cb1kenobi Awesome, worked perfectly. Thanks for the explanation!