pbxFile: Replace lookup via Product Type by lookup via Filetype
diff --git a/lib/pbxFile.js b/lib/pbxFile.js
index 5281d07..4ba2fa8 100644
--- a/lib/pbxFile.js
+++ b/lib/pbxFile.js
@@ -30,18 +30,6 @@
         xctest: 'wrapper.cfbundle',
         xib: 'file.xib'
     },
-    EXTENSION_BY_PRODUCTTYPE = {
-        'com.apple.product-type.application': 'app',
-        'com.apple.product-type.application.watchapp': 'app',
-        'com.apple.product-type.app-extension': 'appex',
-        'com.apple.product-type.watchkit-extension': 'appex',
-        'com.apple.product-type.bundle': 'bundle',
-        'com.apple.product-type.bundle.unit-test': 'xctest',
-        'com.apple.product-type.framework': 'framework',
-        'com.apple.product-type.library.dynamic': 'dylib',
-        'com.apple.product-type.library.static': 'a',
-        'com.apple.product-type.tool': ''
-    },
     GROUP_BY_FILETYPE = {
         'archive.ar': 'Frameworks',
         'compiled.mach-o.dylib': 'Frameworks',
@@ -82,13 +70,14 @@
 }
 
 function defaultExtension(fileRef) {
-    var extension = EXTENSION_BY_PRODUCTTYPE[fileRef.explicitFileType];
+    var filetype = fileRef.explicitFileType.replace(/^"|"$/g, '');
 
-    if (!extension) {
-        return;
+    for(var extension in FILETYPE_BY_EXTENSION) {
+        if(FILETYPE_BY_EXTENSION.hasOwnProperty(extension) ) {
+             if(FILETYPE_BY_EXTENSION[extension] === filetype )
+                 return extension;
+        }
     }
-
-    return extension;
 }
 
 function defaultEncoding(fileRef) {
@@ -175,7 +164,7 @@
 
     this.sourceTree = opt.sourceTree || defaultSourcetree(this);
 
-    if (opt.weak && opt.weak === true) 
+    if (opt.weak && opt.weak === true)
         this.settings = { ATTRIBUTES: ['Weak'] };
 
     if (opt.compilerFlags) {