Embedding Frameworks In An App

Adding A Framework Target

Apps wishing to utilise frameworks to share code across different parts of their application, such as between an app and an app extension, need to start from the framework template appropriate for the app’s target platform. The framework target can be added to the same project as the app target, or it can be added to a separate Xcode project.

  1. Create a new Xcode target and select the framework template appropriate for your app’s target platform.
  2. Add all of the framework source files to the new target’s Compile Sources build phase.
  3. Set the visibility of header files needed by clients of the framework to Public.
  4. Add the public headers to the umbrella header file. If your framework is named YourFramework, the umbrella header is named YourFramework.h.
  5. Follow the steps in Configuring Your Project to configure the new framework target as a dependency of the app target.

Configuring Your Project

Before embedding a framework, set up your Xcode project so the app target depends on the framework target. The following sections describe how to set up this dependency for common project scenarios.

Embedding a Framework

The steps to embed a framework vary, depending on the type of app you are building. The following sections describe how to embed the framework inside the built app for the different types of apps.

Embedding a Framework in an iMessage App

  1. Open the iMessage app’s Xcode project or workspace.
  2. Go to the Build Phases for the iMessage extension target.
  3. Add the framework to the Link Binaries With Libraries list. See Figure 3.
  4. Go to the Build Phases for the iMessage app target.
  5. Add a New Copy Files Phase by selecting the Add icon, highlighted in Figure 4. Set the Destination field to Frameworks, and add the framework to the list. Ensure Code Sign on Copy is checked.



Embedding a Framework in iOS, macOS, watchOS, and tvOS Apps

  1. Open the app’s Xcode project or workspace.
  2. Go to the app target’s General configuration page.
  3. Add the framework target to the Embedded Binaries section by clicking the Add icon, highlighted in Figure 5. Do not drag in the framework from Finder.
  4. Select your framework from the list of binaries that can be embedded.




Posted in iOS Development | Tagged , , , , , , , | Leave a comment

SOAP Web Service Implementation in iOS

Introduction to SOAP 1.2 –  With the introduction to SOAP 1.2 , W3C has fixed many of the perceived short comings of the technology and pushing this to new levels of both adoption and ease-of -use. It should also be noted that the acronym SOAP no longer stands for Simple Object Access Protocol as of the 1.2 specification from the W3C organisation. If we have the following features then SOAP is a great solution :

  1. Asynchronous processing and invocation – If your application needs a guaranteed level of reliability and security then SOAP 1.2 offers additional standards to ensure this type of operations.
  2. Formal contracts – If both sides (provider and consumer) have to agree on the exchange format then SOAP 1.2 gives the rigid specifications for the type of interaction.
  3. State based operation – If the application needs contextual information and conversational state management then SOAP 1.2 has the support for Security, Transaction, Coordination, etc.

SOAP Building Blocks – A SOAP message is an ordinary XML document containing the following elements :-                                                                                                                           Envelope – Identifies the XML document as a SOAP message.                                               Header – Contains header information.It’s optional to include in envelop.                               Body – Contains call and response information.It’s required to include in envelop.               Fault – Provides information about errors that occurred while processing the message.

WSDL (Web Services Description Language) – WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes.

Tools to generate iOS code from WSDL For SOAP Requests                                                    In iOS platform there is requirement to get iOS (Objective C) code from WSDL  for which we required to implement SOAP web service.There are mainly five tools which are used for generating code from WSDL in iOS technology.

  • Wsdl2Code
  • Wsdl2objc
  • WSClient++
  • Sudzc
  • GSoap toolkit

1. Wsdl2Code – Wsdl2Code engine is best tool to convert WSDL to iOS code via submitting WSDL link on it’s home page  http://www.wsdl2code.com/Pages/Home.aspx .iPhone generated code works with Xpathquery , libxml library and NSdata+Base64 for byte array Support.

2. Wsdl2objc – Wsdl2objc is an offline tool to convert WSDL to ios code. As input it is taking url and path where code will save on disk. Easy to use and implement for developers.

3. WSClient++ –  WSClient++ is an offline tool for generating iOS code from WSDL. Generated code is Non-managed and hard to handle. Code is in Non – ARC format  so required to convert it in ARC compatible code.There is requirement to add NSWSDL.h and NSWSDL.m file as resource of parsing files in project. We can download this from http://wsclient.neurospeech.com/ .

4. Sudzc –  Sudzc is an online paid tool for generating iOS code from WSDL via going on this link http://sudzc.com/.

 5. GSoap toolkit – GSoap toolkit is an opensource tool to convert WSDl in c/c++ form which can be use in iOS project for implementation of Soap. Hard to use use because of platform dependencies and hard to manage the code when integrating with objective C.

Code Implementation in iOS – If WSDL requirement is not too large and as parameters, there are no objects to send over web service then for implementation in iOS we can implement like this :-

NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n" "<Hello xmlns=\"http://viium.com/\">\n" 
"</soap:Envelope>\n", nameInput.text];  // nameInput contains parameter value

NSURL *url = [NSURL URLWithString:@"http://viium.com/WebService/HelloWorld.asmx"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: @"http://viium.com/Hello" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if( theConnection )
    webData = [[NSMutableData data] retain];

Differences between SOAP versions 

  • SOAP 1.1 is based on XML 1.0  and SOAP 1.2 is based on XML Information Set (XML Info-set).
  • In SOAP 1.2 , you can use the specification of a binding to an underlying protocol to determine which XML serialisation is used in the underlying protocol data units. The HTTP binding that is specified in SOAP 1.2 – Part 2 uses XML 1.0 as the serialisation of the SOAP message info-set.
  • The XML namespaces for the envelope and encoding schemas have changed for SOAP 1.2. These changes distinguish SOAP processors from SOAP 1.1 and SOAP 1.2 messages and supports changes in the SOAP schema, without affecting existing implementations.
  • SOAP 1.1 is a single document. The SOAP 1.2 specification is organised in the parts.
Posted in iOS Development | Tagged , , , , , , | Leave a comment

SOAP with Attachments using MTOM

SOAP with Attachments – SwA (SOAP with Attachments) is a mechanism for using the existing SOAP and MIME facilities to perfect the transmission of files using Web Services invocations. SwA is a W3C Note. It was submitted as a proposal , but it was not adopted by W3C. Instead, MTOM is the W3C Recommendation for handling binary data in SOAP messages.

Problem Statement –

In case of Mobile Architecture (iOS and Android Apps) , OS plateforms trying to load the entire SOAP message into memory causing out of memory errors. So simple SOAP message without MTOM can create a lot problem in app development.

MTOM (Message Transmission Optimisation Mechanism) – MTOM uses the XML-binary Optimized Packaging (XOP) in the context of SOAP and Multipurpose Internet Mail Extensions (MIME) over HTTP. XOP defines a serialization mechanism for the XML Infoset with binary content that is not only applicable to SOAP and MIME packaging, but to any XML Infoset and any packaging mechanism. It is an alternate serialization of XML that happens to look like a MIME multipart or related package, with XML documents as the root part. MTOM is solution of following problems which occurs when sending a large amount of binary data.

  1. base64 encoding data takes time.
  2. base64 encoding data increases its size by 33%.
  3. Most SOAP implementations will try to load the entire SOAP message into memory causing out of memory errors.

When a SOAP message has an MTOM attachment, the binary data of the attachment is stored “below” the actual XML under a MIME header. This allows the SOAP message to be free of the burden of having to carry a very large string of base64 encoded data. But how do we get the binary data if it isn’t located in the XML itself? This is where XOP comes in. XOP is a method of referencing the binary data in your message from inside the SOAP XML envelope. When the server or client receives a SOAP message it needs to know where in the message the binary data is.

XOP (XML – binary Optimized Packaging) – Using XOP means that instances of XML-type base64Binary, if enabled, are transported by using MIME attachments. If XOP is in use, the implementation can automatically encode it. XOP maintains the data model of the XML message because the attachment is treated as base64-encoded data. If an XML stack understands XOP encoding, your application does not need to be changed at all.By looking at the XOP node we can find the binary data from the Content ID.looks something like this:

xop:Include href="cid:0123456789"xmlns:xop="http://www.w3.org/2004/08/xop/include"

SOAP Message Format without MTOM – Without MTOM, the data is encoded in whatever format is described in the schema (base64 or hex) and then appears in the XML document. The following example shows a SOAP message with an <xsd:base64Binary> element.

... other transport headers ... 
Content-Type: text/xml; charset=UTF-8

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <sendImage xmlns="http://org/apache/axis2/jaxws/sample/mtom">
                       R0lGODl  ... more base64 encoded data ...  KTJk8giAAA7

SOAP Message Format with MTOM – When MTOM is enabled, the binary data that represents the attachment is included as a MIME attachment to the SOAP message. The following example shows an MTOM-enabled SOAP message with attachment data:

... other transport headers ... 
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_0FE43E4D025F0BF3DC11582467646812; 
type="application/xop+xml"; start="<0.urn:uuid:0FE43E4D025F0BF3DC11582467646813@apache.org>"; 
start-info="text/xml"; charset=UTF-8

content-type: application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding: binary

<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
           <sendImage xmlns="http://org/apache/axis2/jaxws/sample/mtom">
              <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" 
content-type: text/plain
content-transfer-encoding: binary

... binary data goes here ...
Posted in Uncategorized | 1 Comment

iOS Background Mode VOIP – Exploring with Experiments

In iOS, Most apps will get completely suspended in Background modes. If you want to know more about background mode, you can read this article Support for applications running in background – iOS .

VoIP Background Mode – VoIP stands for Voice over Internet protocol or internet telephony, when apps connects to server it keeps the connection open while in background and gets callbacks when apps gets something from connection. In InnovationM, We have explored the VoIP Background mode in different – different conditions & scenarios.

Let’s get started !

VoIP iOS Client Application

The easiest way to build VoIP app is by using the CFStreamCreatePairWithSocketToHost function. That means a lot of bridging to be able to use the NSInputStream and NSOutputStream classes afterwards. After the streams are configured we only need to open the connection on both.

- (IBAction)connect:(id)sender
    if (!self.inputStream)
       // Configure the connections
        CFReadStreamRef readStream;
        CFWriteStreamRef writeStream;
        CFStreamCreatePairWithSocketToHost(NULL, @"",@"6666", &readStream, &writeStream);

        self.sentPing = NO;
        self.communicationLog = [[NSMutableString alloc] init];
        self.inputStream = (__bridge_transfer NSInputStream *)readStream;
        self.outputStream = (__bridge_transfer NSOutputStream *)writeStream;
        [self.inputStream setProperty:NSStreamNetworkServiceTypeVoIP forKey:NSStreamNetworkServiceType];
     // Setting the self delegate in input/output stream
        [self.inputStream setDelegate:self];
        [self.outputStream setDelegate:self];
        [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
        [self.outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];

        // Open the Connection
        [self.inputStream open];
        [self.outputStream open];

        // Set Keep Alive Timeout for 600 seconds Hadler
        [[UIApplication sharedApplication] setKeepAliveTimeout:600 handler:^{
            if (self.outputStream)
                [self.outputStream write:pingString maxLength:strlen((char*)pingString)];
                [self addEvent:@"Ping sent"];

Now you need to add the stream delegate that will receive updates for the connection. Add this code anywhere in your class:

#pragma mark - NSStreamDelegate

- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
    switch (eventCode) {
        case NSStreamEventNone:
            // do nothing.

        case NSStreamEventEndEncountered:
            [self addEvent:@"Connection Closed"];

        case NSStreamEventErrorOccurred:
            [self addEvent:[NSString stringWithFormat:@"Had error: %@", aStream.streamError]];

        case NSStreamEventHasBytesAvailable:
            if (aStream == self.inputStream)
                uint8_t buffer[1024];
                NSInteger bytesRead = [self.inputStream read:buffer maxLength:1024];
                NSString *stringRead = [[NSString alloc] initWithBytes:buffer length:bytesRead encoding:NSUTF8StringEncoding];
                stringRead = [stringRead stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];

                [self addEvent:[NSString stringWithFormat:@"Received: %@", stringRead]];

                if ([stringRead isEqualToString:@"notify"])
                    UILocalNotification *notification = [[UILocalNotification alloc] init];
                    notification.alertBody = @"New VOIP call";
                    notification.alertAction = @"Answer";
                    [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
                else if ([stringRead isEqualToString:@"ping"])
                    [self.outputStream write:pongString maxLength:strlen((char*)pongString)];

        case NSStreamEventHasSpaceAvailable:
            if (aStream == self.outputStream && !self.sentPing)
                self.sentPing = YES;
                if (aStream == self.outputStream)
                    [self.outputStream write:pingString maxLength:strlen((char*)pingString)];
                    [self addEvent:@"Ping sent"];

        case NSStreamEventOpenCompleted:
            if (aStream == self.inputStream)
                [self addEvent:@"Connection Opened"];


Here, we need to add App Provides Voice over IP Service in background modes of info.plist.


Server side configuration for VoIP 

Now we need to setup Server side configuration for connection with client. And for this we are using JAVA here. Initially we will setting up a socket connection which listening on a fix port.

ServerSocket ss;
Socket s;
MyServer()throws IOException
ss=new ServerSocket(4444);
System.out.println("Server Started");
System.out.println("Client is Connected");
catch (IOException e)
System.out.println("Accept failed: 4444");

Sending Data from server to client to check connection is live or not.

int ch = 0;

System.out.println("Sending" +ch);
dout1=new DataOutputStream(s.getOutputStream());
dout1.writeUTF("for checking");
catch(Exception oe)
System.out.println("Main expression"+oe);

Experiment Stages for VoIP Application 

  1. Socket Connection without VoIP Background Mode registered.
  2. Socket Connection with VoIP registered.
  3. iOS Application Terminated.
  4. VoIP App on boot time launch.

Socket Connection without VoIP Background Mode registered

When we made a simple socket connection App without registering it with VoIP Background mode then in foreground state of app connection running well. But when app gone in suspended mode Socket connection stopes sending data, it means NO Activity over connection. We have conclude that the connection resumes again when app comes in foreground state from suspended mode. Which clears to us that in suspended mode connection have not broken and it resumes when comes to foreground.

We observe the same behaviour of app as above in case of Socket Connection with other Background Mode registered with Application.

Socket Connection with VoIP registered

When we registered Socket connection app with VoIP Background mode then app’s Socket connection with server is continuos in foreground as well as background state of application. Actually when application goes in suspended mode control over the app takes by Apple iOS and when any communication detects then control with CPU cycles again given to the VoIP app.

iOS Application Terminated

If we kill the application whether it registered with VoIP or not. It breaks the connection And sending of data from server side stopped and it’s shows the Socket connection broken. this message shows up because we checked it via below java code on server side.

int i = 1;
		System.out.println("Thread Validity of socket");		
		while(i == 1)
					System.out.println("Socket connection broken");		

					System.out.println("Socket connected");		

VoIP App on boot time launch

In Apple iOS devices, on boot time launch OS awake all it’s own app (Which was built in the iOS devices and developed by Apple via their private API’s) only. But only one type of application which developed by iOS developers and awake by apple iOS itself at boot time launch , is VoIP applications. So if we reboot a iOS device then those applications are registered with VoIP background modes , launched by iOS itself.

Posted in iOS Development | Tagged , , , | 1 Comment

Swift Programming : Future of Apple Softwares

From the starting decades of programming languages it were a discussion topic among developers to find best approaching programming language which could be fast , understandable, easy to handle and maintainable. In WWDC 2014 Apple introduced a new language ‘Swift Programming language ‘ a Object oriented programming language, which will going to be future of Apple Software development. From last two decades Apple uses Objective C for their Mac OS X Software developments as well as from last six years for iOS Software development too.

Swift feels familiar to Objective-C developers. It adopts the readability of Objective-C’s named parameters and the power of Objective-C’s dynamic object model. Objective-C was always a hard language to pick up for new developers. Apple Software developers will also have to see if Swift makes getting started with app development on Apple’s platforms easier, but from a first look at the documentation, it definitely feels more accessible than Objective-C. According to Apple, Swift will provide a number of significant speed advantages to developers. A complex object sort, for example, will run 3.9x faster than an implementation of the same algorithm in Python. That’s also faster than Objective-C, which is 2.8x faster than the Python version.

More About language :-

Like SCALA, Swift makes a distinction between immutable and mutable references. Whereas SCALA uses ‘var’ for mutable and ‘val’ for immutable references, Swift uses ‘var’ and ‘let’. 
Swift supports an enhanced case statement that implements pattern matching, similar to pattern matching in Haskell or Scala, but less powerful. Pattern matching appears to be able to match a test value against one or more cases by comparing values, but not by comparing structure (as is possible in Scala). Pattern matching cases can include conditional tests.
Like many modern languages, Swift supports functions as first-class objects and closures(as did Objective-C, in the form of blocks). Closure syntax in Swift is far less esoteric than block syntax for Objective-C. In addition, it is possible to define inline lambda functions using placeholder syntax for arguments, a bit of syntactic sugar that Objective-C’s blocks lacked.
To provide an example: in Objective-C, declaring a variable holding a block describing a function which took two NSNumber objects and returned an NSString would look like the following:
NSString *(^myBlock)(NSNumber *, NSNumber *);
In Swift, the following suffices:
var myClosure: (Int, Int) -> String
Features :-
Swift has many other features to make your code more expressive:
1.Closures unified with function pointers.
2.Functional programming patterns, e.g.: map and filter.
3.Tuples and multiple return values.
4.Fast and concise iteration over a range or collection.
5.Structs that support methods, extensions, protocols.

Conclusion :-

Swift incorporates features that support a functional style of programming, such as first-class treatment of functions, closures, clear delineation between mutable and immutable references, and functions such as ‘map’ upon collection types. Like its predecessors, it is small and coherently designed, implementing a carefully selected set of features that contribute to concise yet readable code.

So I hope it will be too enjoyable to learn future of Apple development which will start a new era in the field of Mobile Application development .Let’s Learn..!!!

Posted in Uncategorized | Tagged , , , , | Leave a comment

iOS Development With Various Programming languages

In this competitive world of programming language, iOS and Mac Application Development not only tied with Objective C programming. It come up with a more explosion of other programming languages. After all, early on the iPhone Developer Program License Agreement stated that “no interpreted code may be downloaded or used in an Application except for code that is interpreted and run by Apple’s Documented APIs and built- in interpreters. Apple made changes to the developer license (circa April 2010) which forbade developing iOS applications in any language other than Objective-C and JavaScript (the JavaScript could be used either to build web apps or native apps via the UIWebView). (In September 2010), Apple again changed the developer license to allow the use of scripting languages.

Now , two question arises here :-
1.What programming languages can one use to develop iPhone, iPod Touch and iPad (iOS) applications ?
Ruby, Python, Lua, Scheme, Lisp, Smalltalk, C#, Haskell, action script, JavaScript, Objective-C, C++, C. That’s just the ones that pop into my head right now. I’m sure there’s hundreds if not thousands of others.
2. Also are there plans in the future to expand the amount of programming languages that iOS will support?
Pretty much every programming language community on this planet is currently working on getting their language to run on iOS.

I am going to discuss here different languages with their supportive environment for the iOS development. May be some of IDE’s are paid Or cost a lot rather than developing in Objective C / via Xcode but it beneficial for those who don’t want to learn new languages.

1. Java :- RoboVM translates Java byte code into native ARM or x86 code. Apps run fast directly on the CPU. No interpreter involved. RoboVM includes a Java to Objective-C bridge that makes it possible to call into the native iOS cocoa touch APIs. Objective-C objects can be used just like any other Java object.The compile time tools are GPLv2 licensed. Runtime code is licensed under business friendly licenses, mostly the Apache License v2.0. RoboVM comes with Eclipse and Maven integration. Use the tools you’re used to from the Java world. There are already a number of apps built with the help of RoboVM in the App Store. Easily share code between desktop, Android and iOS apps. The standard classes (java.lang.*, java.util.*, etc) included in RoboVM are based on Android’s runtime.
Reference URL :- http://www.robovm.org

2. Dot Net / C# :- Easily share code between iOS, Android and Windows devices. High-performance compiled code with full access to all the native APIs, including UIKit. Everything you love about .NET, including LINQ, Delegates and Events. Explore APIs as you type with code auto completion. Use your favorite .NET libraries in Xamarin iOS applications. Easily bind third-party native libraries and frameworks. Or use the Xamarin Component Store, which offers dozens of third-party libraries packaged for instant adoption. Xamarin iOS provides full access to iOS APIs. Take advantage of the entire spectrum of rich functionality supplied by the latest version of the platform. Xamarin iOS is frequently updated and ready with all of the latest iOS features—typically on the same day that Apple releases a platform update.
Reference URL :- http://xamarin.com/

3. C++ :- C++Builder iOS apps will have fast native CPU performance and better security than web-based or scripting language based apps. Full visual designer for iOS user interfaces with multiple device types, resolutions, and orientations. With C++Builder, you get a full range of pixel perfect native styled user interface controls, including buttons, list-boxes and combo boxes, to incorporate into your apps. New in XE6! Mobile apps are a revenue generating opportunity for application developers. Now you can monetize your mobile apps by integrating in app purchases and advertising. C++Builder includes iOS local database support for SQLite and embedded InterBase (ToGo and IBLite) via dbExpress, FireDAC and IBX.
Reference URL :- https://www.embarcadero.com/products/cbuilder/ios-development

4. Ruby :-  RubyMotion implements Ruby on top of the Objective-C runtime and Foundation classes. Thanks to this tight integration, Ruby can interface with iOS and OS X very naturally at no performance expense.RubyMotion transforms the Ruby source code of your project into optimized, blazing-fast machine code using a revolutionary, state-of-the-art static compiler, based on LLVM. It’s Ruby, you don’t need to think about managing memory. Ever. RubyMotion will by itself release the objects you create when they are no longer needed. Our memory model, similar to Objective-C ARC in design, does not require any extra memory or processor footprint to allocate and reclaim unused objects. Shipping iOS and OS X devices such as iPhone, iPad and Mac now feature multi core processors. RubyMotion was designed to be re-entrant and without a global lock in order to allow code to be concurrently executed. RubyMotion comes with a nice interface to Grand Central Dispatch that lets you balance heavy work very easily over CPU cores.
Reference URL :- http://www.rubymotion.com/features/

5. Python :- Pythonista comes with some very cool development friendly features like syntax highlighting and code auto-completion. Code completion can be deactivated in the Settings alongside other options enabled by default. he standard libraries are included for Python, but the developer of Pythonista has also created some handy libraries for things specific to the iPhone/iPad. The major problem with the app is the way to import scripts into it. Most of the blame goes to Apple for not allowing importing of scripts from Dropbox. Apple wants to keep the iOS out of the troubles of malicious code execution, and that’s understandable, but the apps are already jailed, so they can’t access files outside its own folders. Pythonista has an URL Scheme, so it can be called from other programs. This makes it perfect for apps on the iPhone like Launch Center Pro on iPhone that supports URL Schemes to start your Python scripts.
Reference URL :- http://toobler.com/blog/getting-started-with-pythonista-building-ios-apps-in-python/

6. Adobe Flash Professional CS6 :- You can use Flash Professional CS6 to create mobile apps for iOS by publishing projects with Adobe AIR. You can follow the same workflow to create mobile apps for Android. Also, using ActionScript, you can leverage native operating system functionality in your apps by adding features that leverage the device’s accelerometer, touch events, microphone, camera, or vibration. You can also integrate ad networks and in-app purchasing systems with your apps. Take example from here
Reference URL :-  http://www.adobe.com/inspire/2012/12/ios-apps-flash-cs6.html

7. Lua Programming :- Ansca Mobile’s Corona allows you to develop your iOS app entirely in Lua. And it’s not just for iOS. You can also develop apps for Android. In fact, you can use the same source code to build both an iOS and an Android app. This adds a compelling reason to use Lua (and, in particular, to use Corona): the ability to easily build cross-platform applications. Corona’s event system lets you handle touches (including multi-touch), access the GPS and the accelerometer, handle animation, and define custom events. There is a powerful graphics system which allows you to draw circles, rectangles and text. There’s a nice feature where you can overlay a web view for doing things like login screens and a sample application provides a library for connecting to Facebook.
Reference URL :- http://www.luanova.org/ioswithlua

8. Lisp Programming :- Creating mobile applications shouldn’t require you to do everything in Java and Objective-C. With mocl, you can put your application logic into a shared Lisp library that runs on both iOS and Android. Furthermore, since mocl runs an expansive subset of Common Lisp, an ANSI standard like C, you can re-use your CL code across many other Common Lisp implementations. Run your code everywhere — and at native speed. Mobile devices are slower and more resource-constrained than their desktop peers. Accordingly, mocl is a highly optimizing Lisp implementation, delivering tight native code via LLVM/Clang. In fact, mocl is so fast that on some benchmarks, it blows away Google’s own Dalvik JVM. With debugging enabled, mocl provides you stack traces that zero in on the source of errors when they occur. Plus, since mocl generates C/Obj-C code, profiling tools like Apple’s Instruments work great, helping you measure and diagnose performance issues, quickly.
Reference URL :- https://wukix.com/mocl

So if you are not interested in Objective C / Objective C++ then go for above IDE’s and their respective languages to make Native iOS applications for Apple app store.

Posted in Uncategorized | 1 Comment

Secure Sockets Layer Handling in iOS

Secure Sockets Layer  – SSL is the standard for encrypting and authenticating messages and identifying users and servers.

iOS mainly Supports SSL with built in commonly trusted root certificate authorities. It means, if certificate was released by a trusted CA installed on iOS and certificate was not revoked (Certificates can be revoked by OCSP – Online certificate Status Protocol ) , the connection is established very easily.

Problem Statement

If you want to buy something from Amazon server and you connect to a server that your DNS server says is amazon.com and send them your order with your credit card details. There may be number of failures :-

  •  You might not connect to actual Amazon server which looks like Amazon, say amezon.com
  •  Someone might be watching packets of your order so they can steal your card details.
  •  Someone change your order details in sender packets.
  •  There may be chance of “Man in the Middle Attack” ( Setting the connection’s proxy server to     his own server on the attacked device then attacker is able to monitor the communication via     the proxy server).


In iOS we have mainly two options to solve above problem statement : –

  1. Add server’s  certificate to the App’s sandbox keychain .
  2. Perform Validation Manually.

For both options you need to include a DER – encoded X.509 public certificate in your app OR you may choose to have it on the server and take it via URL scheme in iOS at run time. If your server’s certificate is part of a chain of existing root certificate authority, you should install the root certificate rather than your server’s certificate.

NSBundle *bundle = [NSBundle bundleForClass:[self class]];

NSData *iosTrustedCertDerData =

[NSData dataWithContentsOfFile:[bundle pathForResource:@"ios-trusted-cert"


SecCertificateRef certificate =


(CFDataRef) iosTrustedCertDerData);

1. Add server’s certificate to Keychain :-  We can add a certificate to our app’s keychain. This is mainly appropriate when we want iOS to trust certificate for every new socket which creates in application.

- (void) useKeychain: (SecCertificateRef) certificate {

OSStatus err =

SecItemAdd((CFDictionaryRef) [NSDictionary dictionaryWithObjectsAndKeys:

(id) kSecClassCertificate, kSecClass,

certificate, kSecValueRef,



if ((err == noErr) || // success!

(err == errSecDuplicateItem)) { // the cert was already added.  Success!

// create your socket normally.

// This is oversimplified.  Refer to the CFNetwork Guide for more details.

CFReadStreamRef readStream;

CFWriteStreamRef writeStream;











} else {

// handle the error.  There is probably something wrong with your cert.



2. Perform Validation Manually :- If our requirement is only to verify the certificate for the socket which we are creating and for no other sockets in our app. then we can verify our trust in the vert manually. firstly we disable its certificate chain validation in its SSL settings. After that in five simple steps we can evaluate this process.

  • Create a client SSL policy with the hostname of the server.
  • Take out actual certificate from a chain of certificates.
  • Create a trust object from it.
  • Set the anchor certificates, which are the certificates you trust.
  • By comparing anchor certificate and trust object ,we can evaluate the trust object and discover whether the server can be trusted or not.

Self Generated certificates in iOS 

It’s a universal problem in iOS that for Self generated certificates app will generates the result error message “Error Domain=NSURLErrorDomain Code=-1202 “The certificate for this server is invalid..”. To bypass the built-in SSL digital certificate authentication, you need to add the following NSURLConnection delegates.The delegates in short will accept the so called invalid certificate as genuine certificate.

-(BOOL)connection:(NSURLConnection *)connection              canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {          return [protectionSpace.authenticationMethod      isEqualToString:NSURLAuthenticationMethodServerTrust];

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {

[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];

[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];


How can we create .DER file  – For creating .der you must have a working installation of the OpenSSL software in your mac. And use the openSSL command to convert between formats as follows :-                                                                                                                                           To convert a certificate from PEM to DER:                                                                                         x509 -in input.crt -inform PEM –out output.crt -outform DER

How much differ SSL handling in iOS from other mobile platforms – In iOS every application have it’s own sandbox keychain which have the chain of root certificates. So if we install a certificate in app then it will be specific only to this app rather than other mobile platform as android install certificate in OS, so it will be accessible to other than that app for which we are installing that certificate.

Posted in iOS Development | Tagged , , , , , , | 2 Comments