Skip to content

Commit

Permalink
Merge pull request #34 from cheekiatng/timob-20484
Browse files Browse the repository at this point in the history
[TIMOB-20484] Hyperloop: iOS: Local-embedded frameworks not working
  • Loading branch information
hansemannn committed Jun 8, 2016
2 parents f860f3c + 030d775 commit 04cea24
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
13 changes: 10 additions & 3 deletions documentation/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,25 @@ module.exports = {
ios: {
xcodebuild: {
flags: {
FRAMEWORK_SEARCH_PATHS: '/path/to/framework'
FRAMEWORK_SEARCH_PATHS: '../../src'
},
frameworks: [
'FrameworkName'
]
}
},
thirdparty: {
'FrameworkName': {
source: ['src'],
header: 'src',
resource: 'src'
}
}
}
}
};
```

In the above example, `/path/to/framework` should point the the location of the `.framework` file and `FrameworkName` should be the name of the Framework.
In the above example, the value for key `FRAMEWORK_SEARCH_PATHS` should point to the location of the `.framework` file and `FrameworkName` should be the name of the Framework. The `.framework` file should be in the `src` folder in project root.

## Resources

Expand Down
39 changes: 22 additions & 17 deletions iphone/plugin/hyperloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,8 @@ HyperloopiOSBuilder.prototype.updateXcodeProject = function updateXcodeProject()
isa: 'PBXFileReference',
lastKnownFileType: 'wrapper.framework',
name: '"' + framework + '"',
path: '"System/Library/Frameworks/' + framework + '"',
sourceTree: 'SDKROOT'
path: '"../../src/' + framework + '"',
sourceTree: '"<absolute>"'
};
xobjs.PBXFileReference[fileRefUuid + '_comment'] = framework;

Expand Down Expand Up @@ -1009,6 +1009,11 @@ HyperloopiOSBuilder.prototype.hookXcodebuild = function hookXcodebuild(data) {
this.headers.forEach(function (header) {
addParam('HEADER_SEARCH_PATHS', header);
});
//For some reason, when using ticore and having custom headers, the original header search path goes missing.
//FIX ME
if(!this.builder.tiapp.ios['use-jscore-framework']) {
addParam('HEADER_SEARCH_PATHS', 'headers');
}
}

addParam('GCC_PREPROCESSOR_DEFINITIONS', '$(inherited) HYPERLOOP=1');
Expand All @@ -1021,22 +1026,22 @@ HyperloopiOSBuilder.prototype.hookXcodebuild = function hookXcodebuild(data) {
if (value.indexOf(' ') !== -1 && !quotesRegExp.test(value)) {
value = '"' + value + '"';
}

// check if the param is already in the xcodebuild arguments
for (var i = 0; i < args.length; i++) {
var parts = args[i].split('=');
if (parts.length > 1 && parts[0] === key) {
// yes, so merge the values
var values = parts[1].match(/(?:[^\s"]+|"[^"]*")+/g);
if (values.indexOf(value) === -1) {
args[i] = key + '=' + parts[1] + ' ' + value;
value.forEach(function (value) {
// check if the param is already in the xcodebuild arguments
args.forEach(function (arg) {
var parts = arg.split('=');
if (parts.length > 1 && parts[0] === key) {
// yes, so merge the values
var values = parts[1].match(/(?:[^\s"]+|"[^"]*")+/g);
if (values.indexOf(value) === -1) {
arg = key + '=' + parts[1] + ' ' + value;
}
return;
}
return;
}
}

// param does not exist, so just add it
args.push(key + '=' + params[key]);
});
// param does not exist, so just add it
args.push(key + '=' + params[key]);
});
});
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hyperloop",
"version": "1.2.1",
"version": "1.2.2",
"description": "Access native APIs from within Titanium.",
"keywords": [
"appcelerator",
Expand Down

0 comments on commit 04cea24

Please sign in to comment.