Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5823] iOS: Support building to device, directly to the device, skipping iTunes

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-11-02T00:59:07.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 22, 2013 Sprint 22 Core, Release 3.2.0
ComponentsCLI, iOS, Tooling
Labelsmodule_cli, planning-3.2.0, qe-closed-3.2.0
ReporterSindre Sorhus
AssigneeChris Barber
Created2011-10-19T12:03:42.000+0000
Updated2016-07-07T09:06:49.000+0000

Description

When building to device, it would be good to build directly to the device rather then building, then having to sync via iTunes. Here is a good jumping off point: http://stackoverflow.com/questions/5010062/xcodebuild-simulator-or-device For those people who wish to sync to iTunes, we will inject a fake "device ID" that represents iTunes Sync and this will revert to using the existing mechanism.

Comments

  1. Matthew Apperson 2011-10-19

    What are the specs of your box, because a "warm" run for me (just tested) takes about 2min.
  2. Sindre Sorhus 2011-10-19

    I'm on a MacBook Pro 3,1: Processor 2,4 GHz Intel Core 2 Duo Memory 4 GB 667 MHz DDR2 SDRAM Graphics NVIDIA GeForce 8600M GT 256 MB Btw. 2 min is still too much for a hot start, in my opinion. My test was just with the start project, a big project will probably take even more time. Is there a reason Titanium Studio can't deploy the app directly to the device like Xcode does?
  3. Reggie Seagraves 2011-10-21

    Yes, deploying directly to a device requires the use of private undocumented Apple APIs. This is an ongoing area of research for our platform.
  4. Stephen Tramer 2012-07-11

    Duplicate of install-to-device task: TIMOB-8676
  5. Ygor Lemos 2013-02-14

    Any news on that? I guess Rubymotion can deploy directly to device like XCode does using their rack scripts (maybe using xcodebuild under the hood?!?) iTunes completely breaks the dev workflow as it is too slow and unpredictable (specially for people with lots of iOS devices and apps). If you have many apps chances are that the sync will take forever. We really need to move this forward...
  6. Shannon Hicks 2013-05-20

    Please take a look at TIMOB-7053. I request that, since this is being built now, we implement the better workflow right from the get go. Maybe even bring parity to the platforms :)
  7. Far 2013-10-09

    I am using Intellij IDEA for developing with Titanium and it's real bad that there is no CLI command to run app directly on device without manipulation with iTunes sync.
  8. Shannon Hicks 2013-10-17

    Someone just pointed me to https://github.com/Sophrinix/xcode-build-to-device . Perhaps platform can borrow some command line commands :)
  9. Fokke Zandbergen 2013-10-17

  10. Ygor Lemos 2013-10-17

    I second this one... This would make the iOS on-device testing far easier and remove crappy iTunes syncing with all its problems from the process. Please consider merging this to master, developers are screaming for this! :)
  11. Chris Barber 2013-10-17

    I built a prototype using libimobiledevice back in Feb 2013, but I couldn't merge it because it was GPL licensed. I found a way to license it under LGPL and still use libimobiledevice. I'm racing to get this done for the 3.2 release. Stay tuned.
  12. Far 2013-10-17

    Some time ago I found awesome TiShadow http://tishadow.yydigital.com. This allow to make changes in application without recompilation project. It's real speed up development process!
  13. Fokke Zandbergen 2013-10-18

    [~farwayer], TiShadow is awesome but a whole different story. Let's keep this ticket about deploying the actual apps to devices.
  14. Far 2013-10-18

    Ok, I think that it may be temporary solution to someone. About libimobiledevice: as I know there is some problems with iOS7 now. But they promise to solve the problem soon.
  15. Chris Barber 2013-10-18

    [~farwayer] Yeah, I heard that too, but we only need 3% of libimobiledevice and I'm hoping that part isn't the part that has problems. :)
  16. Far 2013-10-18

    The problem is with new security check known as "Trust dialog". I don't know architecture of this lib so let's hope that everything will be fine. But look like resolve this issue is necessary for any action with device.
  17. Dan Tamas 2013-10-22

    I use libimobiledevice in SugarTi and it works pretty neat, you can have a look if you want - https://github.com/rborn/SugarTi/tree/dev
  18. Far 2013-10-24

    Dan Tamas, what iOS version you are using? This issue for iOS7 only. Anyway fix for this issue was merged to master today https://github.com/libimobiledevice/libimobiledevice/issues/20.
  19. Chris Barber 2013-10-24

    Quick update: After analyzing and comparing libimobiledevice to a reverse engineered MobileDevice.framework, we are going down the path of using MobileDevice.framework. Many factors went into this decision. Using MobileDevice allows us to avoid LGPL, easier to wrap in a Node.js C++ addon and thus cleaner integration into the Titanium CLI, and I don't have to spend time trying to build libimobiledevice for Mac OS X. I did prototypes of each and MobileDevice is the better way for what we are trying to accomplish. libimobiledevice isn't entirely out of the running; I have plans to use it on something else. We may have to ditch MobileDevice if I run into issues which I'll know in the next day.
  20. Dan Tamas 2013-10-24

    Cool Chris, keep us posted please :) @Far - Last deploy using SugarTi was done on a 7.0., but as I said, for me is working pretty smooth, I don't have any issue. Anyway, if the license is an issue for Ti, there is no way to use it.
  21. Chris Barber 2013-10-25

    Titanium CLI pull request: https://github.com/appcelerator/titanium/pull/63 Titanium Mobile (master branch) pull request: https://github.com/appcelerator/titanium_mobile/pull/4857 NOTE: These PRs do NOT resolve this ticket! Still need to add --device-id support the iOS build.
  22. Chris Barber 2013-10-25

    Here's a link to the world's most awesome iOS device module written by yours truly: https://npmjs.org/package/node-ios-device
  23. Dan Tamas 2013-10-25

    @[~cbarber] can't wait to play with :)
  24. Francois van Lille 2013-10-27

    Gave node-ios-device a whirl, but... -- it installed without a hitch, -- it successfully identified my connected device (an iPad 3 running 7.02), but -- calling installApp just returned "[Error: Failed to copy app to device (-402653177)]" I pointed to the .app file generated by ti build at "/build/iphone/build/Debug-iphonesimulator/.app". Any ideas? Would be pretty sweet to get this working (congratulations on whipping up the module, btw)...
  25. Chris Barber 2013-10-27

    [~francoisvl] You can't install a Titanium app that was built for the simulator for 2 reasons: 1) This library cannot install an app if the .app folder contains symlinks, which simulator builds do. We symlink as many files as possible for speed. I've updated the library to display a more meaningful message in this case. 2) You still need to sign the app with a valid provisioning profile, which simulator builds skip. Do a device build and then try installing the app again. It should work like a champ.
  26. Nikhil N 2013-10-27

    This just works so damn well! I'll probably have to write a CLI based wrapper around this, so one can quickly invoke it to see a list of connected devices, select one, and point to the path of the .app file to install it. Great work!
  27. Nikhil N 2013-10-27

    I've written a quick CLI implementation for this. Can someone please help with converting this bit to a NPM package https://github.com/dezinezync/DZMob Cheers!
  28. Fokke Zandbergen 2013-10-27

    Awesome [~dezinezync], event better would be to just loop all devices and transfer the app in /build/iphone... to all of them :) [~cbarber], I guess you will add this to the titanium CLI?
  29. Andrew McElroy 2013-10-27

    One thing to keep in mind when using the mobiledevice library ( I ran into this with b2i) is that sometimes it will build the project in the DerivedData folder and completely fail to copy over assets. http://blog.codexlabs.com/blog/2013/09/22/titanium-alloy-app-js-not-found-what-is-going-on-and-how-to-fix-it/ This is why build-to-xcode https://github.com/Sophrinix/xcode-build-to-device is written the way it is. xcodebuild -project "pwd"/build/iphone/*.xcodeproj -configuration Debug -sdk iphoneos CONFIGURATION_BUILD_DIR="pwd/build/iphone/build/" I specifically had to make sure that I knew where the project was being built, so that it would copy over my assets reliably. Last note: At the end of the day the only reason why I used MobileDevice library is because I needed the private API call AMDeviceSecureTransferPath I really hope this feature makes it in to 3.2.0. If there's anything I can do to move this along, please let me know.
  30. Chris Barber 2013-10-27

    [~dezinezync] Awesome! I had thought of including something similar directly in node-ios-device, but didn't have time. Plus I didn't want to introduce dependencies like Commander, so if we could make a dependency free version, then we could just add it to node-ios-device itself. [~fokke] and everyone, you will be able to run "ti info \-t ios" to get all attached devices. If you're writing tooling, you can also run "ti info \-t ios \-o json" to make the output easier to parse. "ti info" in 3.2 will also return attached Android devices as well as iOS Simulators and Android emulators (including Genymotion). Quick note on the iOS Simulators: I have introduced the concept of iOS Simulator profiles that set the "\-\-sim-type", "\-\-retina", "\-\-tall", and "\-\-sim-64bit" just by select a profile such as "iPhone Retina (4 inch)". In Titanium 3.2, when you do an iOS device build, you will be required to specify the "\-\-device-id <id>" option. It defaults to "itunes" and installs apps the same as today. There is a CLI config option called "ios.autoSelectDevice" that defaults to true. So if you do not specify "\-\-device-id" and "ios.autoSelectDevice" is true, it'll install the app using iTunes. If you do not specify "\-\-device-id" and "ios.autoSelectDevice" is false, then it will prompt you with a list of connected iOS devices using my handy dandy fields (https://npmjs.org/package/fields) node module. I'm hoping that the integration of node-ios-device into the CLI will be so smooth that you won't need additional tools to install iOS apps to a device. [~sophrinix] I'm hoping to avoid a lot of those issues since node-ios-device will only be called for device builds and device builds do not symlink files and forces you to select a provisioning profile. Don't worry, this stuff will all be sorted out in the next couple days. When this ticket is resolved, that means it will have been merged into master and you can play with it. :)
  31. Fokke Zandbergen 2013-10-27

    [~cbarber] this will be awesome! Why not, when no device-id is given, install the app to all connected devices, without iTunes?
  32. Dan Tamas 2013-10-28

    Cool stuff guys, I think I'm going to steal some code from each of you and use it in SugarTi :)
  33. Nikhil N 2013-10-28

    [~cbarber] I shall try that out. [~fokke] Interesting point! Shall implement that first thing tomorrow morning. I've updated the repo to include details about using the script as is directly as a non-npm version. Once I refactor it to work without commander, I'll send a PR to the mothership repo.
  34. Chris Barber 2013-11-01

    Final pull request? https://github.com/appcelerator/titanium_mobile/pull/4898
  35. likeant 2013-11-02

    how to pull request ??
  36. Wilson Luu 2013-12-11

    Closing ticket as fixed. Verified I was able to build apps directly to device. Tested on: Appcelerator Studio, build: 3.2.0.201312091648 SDK build: 3.2.0.v20131210112451 CLI: 3.2.0-cr Alloy: 1.3.0-cr Xcode: 5.0.2 Device: iphone 5 (7.0.2), iphone 4s (6.0.1)
  37. Dan Tamas 2014-01-10

    [~cbarber] I sometimes have issues with deploying to the device (ios) I get this
        [INFO]  Installing app on device: Muf
        [ERROR] Failed to install app on device (0xe800002d)
        [INFO]  Project built successfully in 1m 21s 225ms
        
    and I either need to rebuild few times, which is painful or deploy using other ways. Any idea what can be wrong? Thnx
  38. Dan Tamas 2014-01-10

    Oh, and sometimes it doesn't even start the install.
        [TRACE] ** BUILD SUCCEEDED **
        [LiveView] No active servers
        [INFO]  Project built successfully in 55s 126m
        
    and exists here.
  39. Chris Barber 2014-01-10

    [~rborn] I've certainly seen the "Failed to install app on device", but I don't recall if I've specifically seen the error "0xe800002d". Some of these errors are borderline impossible to reproduce. You just need to be in a funky state. Turns out you can Google "0xe800002d" or any other hex error code and almost always find a bunch of relevant results. Based on some quick searching, some people claim to resolve it by restarting the device, restarting the device AND doing an iTunes sync, or by backing up, then restoring the device. Another guy said turn off the device, deauthorize iTunes, authorize iTunes, turn on device. Since restarting the device is pretty easy, try that. Possibly do a quick iTunes sync after restarting.
  40. Dan Tamas 2014-01-10

    Did so, it seems to have the same issues with fruitstrap. Interesting because libmobiledevice almost never fails. Don't take me wrong, I'm just saying :)
  41. Ygor Lemos 2014-01-10

    I got this bizarre hex error and found out somewhere that reinstalling MobileDevice.pkg would solve it... I did it and indeed it solved the matter. Go to /Applications/, do a Show Package Contents on Xcode. Go to: Xcode/Contents/Resources/Packages Execute and Install MobilePackage.pkg solved it for me.
  42. Dan Tamas 2014-01-10

    Ok reading this: https://discussions.apple.com/message/22259434#22259434 "_apple-mobdev._tcp.local. has already appeared on interface 4. Suppressing duplicate attach notification." reminded me I have attached a syslog to see the device logs. Killed that process and it seems to install :D BTW have a look at this, I use it in a terminal but would be amazing to have it in ti https://github.com/eswick/deviceconsole If I'll ever have the time to work again on SugarTi I'll implement it for sure :) Sorry for the mess.
  43. Dan Tamas 2014-01-10

    [~ygbr] interesting....I'll have a look, thnx :)
  44. Chris Barber 2014-01-10

    [~rborn] libimobiledevice has basically reimplemented all of Apple's APIs, so there's no telling what they are doing that make things work. As I'm sure you know, I use MobileDevice, not libimobiledevice. This was because of ease to implement and license. Here's the source for what we use https://github.com/appcelerator/node-ios-device. THANK YOU for the link to deviceconsole! This is amazing. I have been wanting to implement this for quite some time now. I should be able to add support for that to node-ios-device. I created a ticket for you to watch here TIMOB-16162.
  45. Dan Tamas 2014-01-10

    I know they reimplemented everything, and we cannot use due the license issues. I was just saying that their implementation doesn't have this issue, BEFORE finding out I was having the syslog active :) deviceconsole - Glad to know you can use it :)

JSON Source