Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Titanium Mobile 1.4.1.1. deletes Xcode's iOS File Templates

Sorry if this is the wrong place to file a bug report. I searched the whole site and even googled, but no explicit bugreporting option showed up…

I just clean-installed the latest version of Titanium Mobile. I want to implement my own custom module. So i followed the steps in the Module_Developers_Guide_iOS.pdf file. When Titanium installed its Template Files (into /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/File\ Templates/Appcelerator) it deleted all standard Xcode File Templates for iOS at /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/File\ Templates/. Now, if i want to create a new UITableViewController subclass, the file template doesn't show up any more in Xcode's New File Template Chooser. :(

Anyone else having the same issue? Is there a known workaround? Or do we have to wait for a bugfix?

Thanks in advance.

— asked October 9th 2010 by Mr. Q
  • bug
  • ios
  • iphone
  • templates
  • xcode
2 Comments
  • I had the same problem again. The issue occurs every time when creating a new module from the Terminal.app using the command

    > titanium create --platform=iphone --type=module ...
    

    as noted in the Module_Developers_Guide_iOS.pdf document.

    — commented November 3rd 2010 by Mr. Q
  • Update:

    the bug seems to be in the file

    titanium_mobile/support/module/iphone/xcode/install.py
    

    the related bug is on line 15-16:

    // -- snip --
    if os.path.exists(file_dir):
        shutil.rmtree(file_dir)
    // -- snip --
    
    — commented November 3rd 2010 by Mr. Q

3 Answers

  • Has this been fixed? I just lost all of my xcode templates, again. Pretty frustrating.

    — answered May 10th 2011 by Tony Arkles
    permalink
    2 Comments
    • Unfortunately not. At least not until sdk v1.5. Since then, i didn't check any newer version because i don't use titanium any more. It's too much of a pain for what wanted to do with it.
      I had to copy the template files from another machine to get them back. Then i searched for the python script that caused the issue and commented out the 'install ti-templates' part. I was sort of horrified, that the script tries to install the templates on every build… So, it won't help if you just copy back the original xcode templates once.

      — commented May 10th 2011 by Mr. Q
    • Any idea how to get this post in front of people who can actually fix this? I posted the bug-fixed version of install.py here, but I don't know if it'll ever make it into a release…

      — commented May 10th 2011 by Tony Arkles
  • I don't make a habit of fixing other peoples' buggy software, but this is an updated version of /Library/Application Support/Titanium/mobilesdk/osx/1.6.2/module/iphone/xcode/install.py that doesn't destroy the XCode templates every time.

    
    #!/usr/bin/env python                                                                                                                                                              
    # -*- coding: utf-8 -*-                                                                                                                                                            
    #                                                                                                                                                                                  
    # Simple script that installs the Titanium class templates to the default platform location                                                                                        
    #                                                                                                                                                                                  
    import os, sys, shutil
    
    template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
    
    #TODO: need to run xcode-select to get the true path to xcode                                                                                                                      
    
    xcodedir = os.path.join("/Developer","Platforms","iPhoneOS.platform","Developer","Library","Xcode")
    target_dir = os.path.join(xcodedir,"File Templates", "Appcelerator")
    file_dir = os.path.join(xcodedir,"File Templates")
    
    if os.path.exists(target_dir):
            shutil.rmtree(target_dir)
    
    if not os.path.exists(file_dir):
            os.makedirs(file_dir)
    
    shutil.copytree(os.path.join(template_dir,'Titanium'), target_dir)
    
    print "Appcelerator Titanium XCode templates installed"
    
    sys.exit(0)
    
    — answered May 10th 2011 by Tony Arkles
    permalink
    0 Comments
  • Hi

    I had the same issue : I had to copy templates from another mac into my mac.

    Thanks

    — answered October 10th 2010 by Virus Infotech
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.