iOS and Bluetooth Communication

Leave a comment

Communication to Bluetooth devices was possible with External Accessory Framework by registering in MFI program. But this case was until iOS 5 came with which came the CoreBluetooth Framework. But what is the difference between them?

External Accessory Framework:

1.  To use this framework we need to be registered in MFI Program and should have made our bluetooth enabled device MFI compliant. To register here as such we need not pay for Apple. But there are costs involved in getting a certificate from third parties that your hardware does not interface with iOS device.

2. It is available for  all iOS based devices that run in iOS 3.0 and above.

CoreBluetooth Framework:

1. There is no entry cost, no registration needed.

2. It is used only for devices that are compatible with Bluetooth Low Energy.  (Bluetooth Low Energy is a feature of Bluetooth 4.0  which is claimed to be consuming far less power than that of classis Bluetooth devices)

3. iPhone 4S  is the only supported iOS device that is BLE enabled, so Core Bluetooth Framework based app can at this point in time be supported only in that device.

4.  It is supported only from iOS 5.0.


Common iOS memory mistakes developers commit

Leave a comment

Some of the common mistakes an iOS developer does are provided below:

1. Missing dealloc method as part of  each Class

2. Missing [super dealloc] methods call in dealloc method.

3. Leaving NSLog statements in production ready code. Too much NSLog can consume lot of memory and your app will throw memory warning very soon.

4. Not being aware of the power of iOS debugger commands to nail the crashes. Environment variables NSZombieEnabled, NSDebugEnabled, MallocStackLogging can help you a lot in finding the reasons behind crashes.

5. When using the above commands, forgetting to disabled in the production code.

6. Not leveraging the power of accessors. To leverage their power read this document

7. Not setting pointers to nil after releasing. Even though this is not necessary,  doing this is will help us in avoiding any inadvertant usage of this object variable, unless it is reassigned with any other object.

8. Trying to use retainCount of objects created.  Since there is no  1 to 1 correspondence between the retain count and calls to  retain/release, it is better we refrain from sing this.  This link might be use ful .

This list will be a living list and I will keep updating it.

duplicate symbol _OBJC_CLASS_$_SBJSON

1 Comment

I used Selenium NativeDriver for Testing an App. My Application was using JSON Library.  And I was getting the below  error on building:

duplicate symbol _OBJC_CLASS_$_SBJSON.

I learned that The NativeDriver library was using JSON for data transfer. So It also was using the same  JSON library.

I was able to fix the problem by excluding the JSON Source files through Xcode settings.

The fix is as below:

Add a user-defined build setting with the name “EXCLUDED_SOURCE_FILE_NAMES”  in Build Settings for the Project’s Target ,  and for the value add :

JSON.h SBJSON.h SBJSON.m SBJsonBase.h SBJsonBase.m SBJsonParser.h SBJsonParser.m SBJsonWriter.h SBJsonWriter.m NSObject+SBJSON.h NSObject+SBJSON.m NSString+SBJSON.h NSString+SBJSON.m

Below images might help you in adding  User defined setting to Project.

putpkt: write failed, broken pipe

Leave a comment

When you get this error while testing an App in iOS device, with out further ado you can do the following to get out of it:

1. Reboot your device

2. Clean your build and rebuild the project and launch the App.

If you get the same problem again add the following options to your procedure:

1. Delete the App from the device

2. Restart XCode.

At times you can get rid of this problem only by Factory Rest of your device.

Ability to detect change in wi-fi change in iOS

Leave a comment

I was just exploring if we can find when our iPhone or iPad changes from one wi-fi to another. I felt we can detect this based on the SSID of the access point. And there is a framework named MobileApple80211. But since this library internally uses the private APIs of iOS, we can not use this to detect the change in wi-fi network. If you know any other ways to do it, please share it.



5 Things CIOs need to know before mobile-enabling

Leave a comment

Webinar at Aspire Systems

Webinar at Aspire Systems

Join us for a Webinar                                                                         
Theme: 5 things CIOs need to know before mobile-enabling
Date: Thursday, June 2, 2011
Time: 11 AM PST / 2 PM EST

“More than 4 billion people around the world now use cell phones, and for 450 million of those people, the Web is a fully mobile experience,” according to the McKinsey Global Institute. This explosive growth of mobile is having a significant impact on B2C and B2B businesses.

Mobile-enablement, however, is more than just tailoring your website’s content to fit a smaller screen. There are several options and challenges involved in going the mobile route. Executives overseeing mobile initiatives need to be aware of the considerations – in order to get the maximum RoI from their mobile strategy.

Come listen to two experienced practitioners discuss key elements that will be crucial in your mobile strategy, on June 2nd, 2011 at 2 PM EST.

Some areas that will be covered include:

Native mobile apps Vs. Mobile web

Design simplicity: where less is more

Mobile as a new channel for growth

And much more…

Speaker Profiles

William Walsh
Senior Manager – Mobile strategy
Discover Financial Services

William is a pioneer and thought-leader in the wireless industry. He has created and driven development of mobile multimedia applications (now used on 100+ million devices worldwide) including entry into the emerging $13 billion mobile advertising market and $35 billion location based services market.

In his previous role as Mobile Product Manager at Walgreens, he successfully launched Walgreens iPhone, Android, and Blackberry applications. He defined the marketing message for Walgreen’s iPhone application and propelled it to No.3 in the iTunes Lifestyle category – the app also won in 2 categories of the Webby awards.

Vinod K
Mobile Practice Manager
Aspire Systems

Vinod is an IT practitioner for the last 13 years, with over 10 years working in the mobile space. Vinod understands what it takes to go mobile – the challenges, pros and cons of different approaches. He has consulted several Fortune 500 companies and helped them define their mobile roadmap.

Vinod has hands-on experience working on various mobile technologies, right from programming for Palm OS close to 10 years ago, to leading a 20+ member team for a Fortune 500 company in the retail space recently. Vinod led the team working on their iPhone and Android apps (the iphone was subsequently one of the top 5 apps in the iTunes Lifestyle category).

TouchesCancelled Problem in Gesture recognition

1 Comment

While I was working with touch events and gesture recognition , I ran into a peculiar issue. While I swipe down the screen, touches began and touches moved got called and also touches ended at the last. But many times touches cancelled event was called while trying to swipe. In some cases, I was trying to rotate the image slowly, and touches cancelled event got called and it stopped the occurrence of touches moved events. It ended the gesture event in middle and I have to start from the first, i.e from touches began event. We were thinking that touches got cancelled because of the memory warning, but we had no memory warning in our application at all.I had no clue why touches cancelled event got called.

My objective was to rotate an image based on touch events. I was experimenting some code snippets with two different ways. One method is by using UIResponder chain and getting UITouch events(began ,moved and ended). Another method is by using UIGestureRecognizer. I implemented both methods in single application and was developing an application to rotate image. After few experiments, I stick with the first method. I removed only the implementation methods of UIGestureRecognizer.

After struggling a lot, surfing through google, I got an answer. It was due to UIGestureRecognizer. If a gesture recognizer recognizes its gesture, it unbinds the remaining touches of that gesture from their view.The window cancels the previously delivered touches with a touches Cancelled message. After removing all the UIGestureRecognizer codes, now it works fine. I also read that we can also turn off the touches cancel in view property to avoid this behavior, which is yet to be tested.


Older Entries