Recently, I faced this warning with one of the app store upload. It’s always bit mysterious with iOS application errors and warnings. You never know until you face the issue. So I think it’s very important to understand the background and get to the bottom of it.

Why, you Must ? COZ

Quoting from app store review guidelines :We will reject Apps for any content or behavior that we believe is over the line. What line, you ask? Well, as a Supreme Court Justice once said, “I’ll know it when I see it”. And we think that you will also know it when you cross it.

Anyways, It started with  transferring all the apps from one Apple developer account to another.  So, I ended up creating all new certificates, APP IDs and provisioning profile to upload a new version of the existing app. So I am gonna use these new certificates and APP ID for existing app which was uploaded using different certificate and app id.

Hence the below warning :

The application identifier entitlement value has changed. the previous version of the software has an application identifier value of [‘423Y43FF434D.com.mycompany.myapp’] and the new version of the software being submitted has an identifier [‘3434323423YS.com.mycompany.myapp]. This will result in loss of keychain access.

If you compare the application identifier in existing app version (423Y43FF434D) and new app(3434323423YS) both are different. so will it create a problem ?  To understand that, let’s find out what an APP ID is :

Quoting from apple docs: “An App ID prefix is a unique identifier used to group a collection of apps so they can share keychain and UIPasteboard data.

It means, all apps with same APP ID(In this case, 423Y43FF434D) can share the keychain data if new version is uploaded with same APP ID. How’s that ?

Quoting from apple docs: “Every keychain item in iOS contains an attribute called the keychain access group. An iOS app can only access those keychain items it has permission to. This permission comes from the code signing entitlements stamped into the app when it is signed (using your current App ID prefix).”

Hmm…Interesting isn’t it ? So it was APP ID which was making sure that even if I upgrade to a new version of the app, I don’t have to enter my login details again. Pretty useful right. BUT,

Quoting from apple docs again: A one-time loss in keychain data will occur if you switch your App ID prefix.

It means new APP ID will have new keychain access group but the keychain access group used by previous version of app will be ABANDONED. Doesn’t really sound that good, is it ?

But it also mentions, This may have only minor implications in some cases. For example, if your keychain usage is modest it might not be a big deal for you to make a change: apps that simply store a user password in the keychain for convenience, may decide to change their App ID prefix to their Team ID based App ID prefix at the small cost of requiring the user to re-enter their password one more time.

Basically, If existing app in app store uses and store any data in the keychain will not accessible to the new version of the app with new APP ID. So, the new version of the app has to store or collect all the data again and store in new keychain access group. That’s it.

So, the implications are completely depended upon the usage of keychain in your app. At worst, App just needs to collect and store data in the keychain again. Sounds good right, at least we know that our app won’t get rejected or crash for some mysterious reason.

Hope this helps to all other iOS geeks out there. Happy coding!!

Recently, I have been trying out on some testing and figured that it will take me ages to finish the testing for all modules if continue doing manual testing. In addition to that, I am being a developer and  new to the product adds additional obstacles in the way. After few days of struggling through the manual test cases, I decided it’s time to shift UI Automation frameworks for iOS. (Manual testing, it’s really tough. its a patience game… hats off to all the manual testers). I had reasons to

Calabash with iOS 7

I have used Calabash UI Automation framework in the previous iPhone app so it was an easy choice, but since iOS 7 SDK things have changed a bit. Calabash has two ways of launching apps: SimLauncher and Apple instruments tool. Since iOS 7 Apple has removed access to API’s used to synthesize touch events. Even though guys working on calabash framework did update it to support with iOS 7  but I felt it wasn’t easy to get it up and running as I really struggled with it initially, took me 2-3 days to figure it out. I think it was also because there wasn’t much help available online about it. Later I joined calabash-ios google group. It’s really helpful and you will get a response quickly. It also helped me lot to go through the some older posts and try out different things. So I would encourage you to join calabash-ios google group

Firstly, if you are planning to use Calabash for iOS 7, make sure you update  your calabash version to latest(0.9.168 ). Calabash iOS has two parts(as shown in fig. below. Check more about it on this blog):

  • the ruby client library – a ruby gem
  • the calabash.framework – an Objective-C framework that embeds an HTTP server

Calabash-iOS architecture

So make sure both client library and server are updated and compatible. Compatibility is also very important or touch events won’t work. I was facing “Timed out….Retry” issue for a while due to compatibility issues.

Verify Calabash client-server versions

Follow below steps to verify the versions :

# gem version
$ calabash-ios version
0.9.168

# calabash.framework version
# start your app manually in the simulator or from Xcode and then launch a console
$ calabash-ios console
> server_version[‘version’] 
0.9.168

The server_version[‘version’] must be greater that or equal ( >= ) to the FRAMEWORK_VERSION. 

Updating Calabash

In case you have older version follow below steps to Updating Calabash iOS:

1. update the calabash-ios gem
$ gem install calabash-cucumber

2. update the calabash.framework
In the directory that contains the calabash.framework run the following:
$ calabash-ios download

———-Info———-
Found calabash.framework in /Users/krukow/github/talk.
Shall I delete it and download the latest matching version?
Please answer yes (y) or no (n)
y

———-Info———-
caution: excluded filename not matched:  __MACOSX/*
caution: excluded filename not matched:  calabash.framework/.DS_Store
—————————-

3. clean, rebuild, and check

 

Final  steps

Even after following all above steps correctly I faced issues like “Timed out….retry” after a while I was able to figure out the solution.Here are the steps to follow after updating your calabash framework :

  1. do a deep clean of your Xcode project
    1. use the Xcode Project > Clean Build Folder… + Alt key or
    2. use the key command Shift + Option + Command + K
  2. remove any calabash targets from the simulator
  3. ‘Reset the Content and Settings’ in the iOS Simulator or
  4. remove the calabash targets manually
  5. remove any calabash targets from physical devices
  6. rebuild your calabash target
  7. check your calabash gem and calabash framework versions

 

All above steps helped me to get it  up and running. Of course there are a lot of other challenges in terms of custom steps and identifying various ios custom controls along the way. But I will talk about it in later post. Happy Automating!!

Anyone who grew up on PCs will be familiar with the old Shift+Delete trick—that combination of keystrokes that immediately and permanently nukes a file. For many, it’s a surprise to find that OS X doesn’t offer that functionality without cumbersome Terminal commands or third-party apps. Instead, you must first move a file to Trash, and then “empty” the Trash. Only then is a file truly gone—along with everything else in your Trash.

But what if you only want to delete a particular file at a given time? With Automator, you can add the functionality to your context menus (“right-click” menus) using the Services workflow.

You can create an Automator service or application to facilitate executing the rm shell commando, which will permanently delete files or folders and skip the trash.

To begin, start by creating a new Service in the Automator app.

Select “files or folders” as input; you may also want to limit the availability of this service to the Finder app.

Optional—but highly recommended to prevent accidental deletion—is the addition of an Ask for Confirmation step to the workflow. Drag it into your workflow from the column at left, then customize the message and the Cancel and OK buttons to your liking.

Finally, add the Run Shell Script step to the workflow, again dragging from left. Make sure to pass input “as arguments”. Then you can put in the following script:

for f in “$@”
do
rm -rf “$f”
done

To complete the process with a bit of audio confirmation, add the OS X “emptied trash” sound by including the following command at the end of the shell script:

afplay “/System/Library/Components/
CoreAudio.component/Contents/SharedSupport/
SystemSounds/finder/empty trash.aif”

Save your service, and it should be ready to use in Finder from the Services menu in the menu bar. You can also configure a keyboard shortcut to your service in the Keyboard preference pane of System Preferences.

Source/Screenshots : http://apple.stackexchange.com/questions/66369/how-can-i-skip-the-trash-when-deleting-a-file

Enabling JSP support in Jetty.7.0.0

Posted: May 6, 2013 in Java
Tags: , , ,

Jetty7, doesn’t enable jsp support by default, so after  trying for more some time I came across  this blog (suggested to download Jetty from codehaus which comes with jsp libraries). I started with javax.servlet-api-3.0.1.jar and jetty-all.jar  but eventually able to resolve all dependencies to get  my website working. I used almost more than 10 jars to resolve dependencies. Most of the time I just needed some of the classes from those jars to create combination to support my application. Its application specific, it will differ based on various libraries you use in your application.

All the jars I used to make my website up and running:
1. javax.servlet-api-3.0.1.jar
2. jetty-all-8.1.9.v20130131.jar
3. org.apache.jasper.glassfish_2.1.0.v201007080150.jar
4. commons-logging-1.1.2.jar
5. jsp-2.1-6.0.2.jar
6. jetty-util-6.1.12.jar
7. j2ee.jar
8. jsp-api-6.0.14.jar
9.ant-1.7.1.jar
10.ant-launcher-1.7.1.jar
11. jsp-api-2.1-glassfish-9.1.1.B51.p0.jar
But, this is not enough, if you start the server you get an error like this:

INFO::NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet

So you have to enable jsp support in jetty passing additional undocumented options to the jetty start script:

$ java -jar jetty.jar OPTIONS=Server,jsp

The best option to start jetty and customize it is using the provided script: bin/jetty.sh. But you have to do these steps:

# change the permissions of the provided script. $ chmod u+x bin/jetty.sh # create a file where you can put customized options. $ cat /etc/default/jetty JETTY_PORT=80 JETTY_HOME=/usr/local/jetty JAVA_OPTIONS="$JAVA_OPTIONS -Dartifactory.home=/mirai/DATA/artifactory" JETTY_ARGS=OPTIONS=Server,jsp # create the link in /etc/init.d $ sudo ln -s /usr/local/jetty/bin/jetty.sh /etc/init.d/jetty # use this script to start/stop/restart the server $ /etc/init.d/jetty <start|stop|restart>
Hope it helps. drop me a note if in case any queries.

At the time of writing, the number of apps in the iPhone app store looks set to push through the 1 million mark [Already crossed 1 million mark] for the first time. This means that developers and publishers increasingly need to turn to Appstore SEO as a way of improving visibility and driving downloads. Hundreds of agencies are already beginning to offer SEO for the iphone app store as a service, but there’s some simple stuff you can do yourself to improve the visibility of your app.

At present, the iPhone app store search system pretty unsophisticated, which means that some of the tricks that stopped working many years ago in the PC web can still be effective. However, the app store search algorithm is rapidly evolving and already some methods such as keyword stuffing no longer work so easily. That said, there’s still a lot you can do so here’s a guide to the top 7 things you can do to improve your ranking.

1. Use keywords in the app title and developer name. For example, a user searching for “dining” sees a number of apps with “dining” in the title in the top search rankings.

2. Use numbers or the letter ‘A’ in the app title – Using a blank or listing your app with a number at the beginning of the name ensures that the app will be featured near the top of the results in the “sort by name” view under a specific category.

3. Encourage reviews – Only about 0.5% of users leave a review, but one element to the Apple store search algorithm appears to be the number of reviews. Write your own reviews, encourage friends and family, as well as users.

4. Use price drops – a quick way to move up the charts is to reduce the price of your app. For example, one game experimented by cutting the price to 99 cents from $2.99 for two days. Previous to the price drop, the app had been ranked at around 100 in top paid apps. Afterwards, it shot up to second place within 24 hours.

5. Make your app icon active – This is a visual trick that can be very powerful as it catches the users eye. Specially some 3D looking icons.

6. Make the most of your screenshots – make sure the screenshots you display are as attractive a possible and draw people in to want to use the app.

7. List your app in directories – List your app in third party directories and aggregators. Each listing links to your iPhone app store page from within a relevant category to help drive users, downloads and reviews.

Hope this helps. Good Luck!!

Working on my iphone app for last couple of months and all good so far, until one day when I started using awesome Google Analytics library(googleAnalytics.a)  and tried to add it   into my project repository.

Surprisingly,  I was still not able to see the .a file in my svn client even though its there in my project(local copy)  and its never committed. So I googled about it on net and discovered  svn:ignore properties of Subversion.

svn:ignore property contains a list of file patterns which certain Subversion operations will ignore. it works in conjunction with the global-ignores run-time configuration option (see the section called “Config”) to filter unversioned files and directories out of commands svn statussvn add, and svn import.

In my case, .a files are set as ignored files, so i cannot see it in my file listing of svn client and only solution I thought of is to remove *.a from local ignored list. But its tricky.

Fortunately, I found another solution,  Select View -> ignored files and you will see all ignored files in your svn client. So simply add and commit. Done!!

So easy, right!!!!

Thanks to post from Nick

On Stack Overflow there has been some interest in how to use the Delegate design pattern in Objective-C. Of course, the first step in any search should be to read Apple’s documentation, but many people seem not to want to read the whole thing. Trust me, folks, it is worth it. But Apple’s documentation on creating delegates doesn’t use protocols, which are such an amazing and useful part of the Objective-C language.

That being said, I’d like to give a short demonstration of how to create a class with a delegate. For the purposes of this tutorial, we’ll call our class JSTutorial.
The interface to JSTutorial starts out as the following:

@interface JSTutorial: NSObject {
  NSString *title;
  NSString *body;
}
- (void)generateTutorial;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *body;
@end

Now, we need to modify this interface to include a delegate protocol:

@protocol JSTutorialDelegate;
@interface JSTutorial: NSObject {
  NSString *title;
  NSString *body;
  id <JSTutorialDelegate> delegate;
}
- (void)generateTutorial;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *body;
@property (nonatomic, assign) id <JSTutorialDelegate> delegate;
@end
@protocol JSTutorialDelegate <NSObject>
@optional
- (void)tutorialDidFinish:(JSTutorial *)tutorial;
@end

The implementation for JSTutorial might look like this:

@implementation JSTutorial
@synthesize title;
@synthesize body;
@synthesize delegate;
- (void)generateTutorial {
  // do something here?
  [[self delegate] tutorialDidFinish:self];
}
- (void)dealloc {
  [title release];
  [body release];
  [super dealloc];
}
@end

Finally, the class that implements JSTutorialDelegate might have its interface declared as follows:

@interface SomeClass : SomeControllerClass <JSTutorialDelegate>
// …
@end

SomeClass should implement tutorialDidFinish:, but it is optional.

I hope that this has helped those who were struggling with the delegate design pattern.