I include a openssl.a in my xcode project, it can be build local, but xcode integrate server build failed when get it from git.
ld: warning: directory not found for option '-L/Users/sss/Documents/myapp/platforms/ios'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)

it is Library search path hard code issue.
I get to build setting, change both debug and release search path to $("SRCROOT"),

commit the project file change, and push it.
then run the bots from log view, all build successful.

Categories: Mobile | XCode iOS

Below are my full steps of integrating sqlcipher, openssl with sqlite plugin from a fresh Cordova projects.

1. Create a new cordova project folder

$ Sudo Cordova  create newProjectName

you can update the config.xml for you project name and bindId now. And downalod all pugings include sqlite plugin to plugin folders.

copy you html and js to www folder.

2. Create a new XCode projet for iOs

$ Cordova platform add ios

3. Copy icon files and splash files t  the iOS project resource folder.

4. Copy openssl-Xcode to ios folder

Openssl-xcode project skeleton can be get from:

$git clone https://github.com/sqlcipher/openssl-xcode.git

Make sure there is openssl folder in the openssl-xcode folder

Download openssl

$ curl -o openssl-1.0.0e.tar.gz http://www.openssl.org/source/openssl-1.0.0e.tar.gz

Upzip it to Openssl-xcode project folder and rename openssl-1.0.0e to openssl

5 copy sqlCipher folder to ios folder. sqlcipher can be get from

$ git clone https://github.com/sqlcipher/sqlcipher.git

6.  Open project, remove SqlitePlugin.m     and SqlitePlugin.h references
Go to Project Targets, in Build Phase tab, remove libsqlite3.dylib

7. Add openssl and sqlcipher sub-projects:
 File->Add files to project, add openssl-xcode   as sub-project.  Repeat steps to add  sqlcipher as sub-project

8.  Build Configures

   a. Root project, Build Phases ->Target Dependencies, Add  sqlcipher and crypto

   b. Root project. Build Phases-> Link binary with libraries,  add libcrypto.a and libsqlcipher.a

   c. In the two sub-projects.  Build Setting ->Architectures -> Base SDK, make sure both are set to "Latest IOS"

   d. Under "Other C Flags", add -DSQLITE_HAS_CODEC to the Debug and Release C Flag settings. This will ensure that the SQLite key management functions are defined for use by the application.

   e. because sqlcipher has reference to security.framework, if you got the linked reference issure for sqlcipher, you may also need add the secruity.framework reference  in the root project

9. Build the project, the libcrypto.a and libsqlcipher.a will be created.

10 Add sqlite plugin files and reference back

a.      Select plugins, File->Add files to project, add SQLitePlugin.h and SqlitePlugin.m back to project

b.      Make sure libsqlite3.dylib was removed from Link Binary with libraries, because we are using sqlcipher replace it.

11 Build again, It should be no errors

12. Follow the sqliteplugin instruction to add the sqlcipher code. uncomments the line 192 for "sqlite3_key(" to enable sqlcipher

the key is passed from parametters

const char *key = [[options objectForKey:@"key"] UTF8String];
if(key != NULL) sqlite3_key(db, key, strlen(key));

13. Finally step, don't forget include cordova.js in your html

 <script type="text/javascript" src="cordova.js"></script> 
14.  you sqlitedb can be find in you mac:

~Library\Application Support\iPhone Simulator\[ios_version]\Applications\[appguid]\cocument\[dbname]

Categories: Mobile | XCode iOS

Apple Push Notification Service





 Choosing proviling profile and export ad hoc ipx file


Categories: Mobile | XCode iOS

Note: below solution just for not using InAppBrowser plugin,

When InAppBrowser plugin was add correctly, simply call open.window(url,"_system") will open url in new Browser.

First check your your config.xml , You can define your whiteList by change , for detail how to do it, please check http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html and will make any url not in white list be open in new safari window instand of InWebView.

If your url is in your white list (ex, you use * make all urls are allowed) but you want to open some url in safari, You have to add extra code to do that.

My solution is like below: first I define a function to open safary url:

LaunchNewWindow: function (url) {       
   if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {         
    window.open(url+"#_external", "_blank");}
    window.open(url, "_blank");

then you have to change code in CordovaLic\Classses\CDViewController.m to handle your spacial url: I added it in line685 :

else {

// start stoneskin's change: force open external url in safari                              
               if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
NSString *myurlstr = [url absoluteString];
if ([myurlstr rangeOfString:@"#_external"].location != NSNotFound){
myurlstr = [myurlstr stringByReplacingOccurrencesOfString:@"#_external" withString:@""];
NSURL *myurl = [NSURL URLWithString:myurlstr];
[[UIApplication sharedApplication] openURL:myurl];
return NO;
//end start stoneskin's change if ([self.whitelist schemeIsAllowed:[url scheme]]) { return [self.whitelist URLIsAllowed:url]; } else { if ([[UIApplication sharedApplication] canOpenURL:url]) { [[UIApplication sharedApplication] openURL:url]; } else { // handle any custom schemes to plugins [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; } } return NO; }
Don't forget this code only working for Phonegap wrapped app.

Categories: JQuery | Mobile | XCode iOS