Thursday, December 22, 2011
How to validate the iOS device has FaceTime feature
BOOL val = [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString: @"facetime://5555555555"]];
NSLog((val)?@"Yes":@"NO");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:(val)?@"Yes":@"No" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
[alert show];
[alert release];
if(val){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"facetime://5555555555"]];
}
Phone Contacts backup in MAC using BT
Nothing, What I did is just exported my phone contacts as vcf (electonic business card file) to my system using BT (Bluetooth).
Even, if you created contacts in the mac machine contacts application. It can be exported as vcf and send back to mobile device to restore/add contact.
What else! That's all we are done with backing up with our mobile contacts.
Mobile Device Used: Samsung Star - s5233
Wednesday, December 21, 2011
Customizing the TabBar images in iOS
Here is the sample code for you how to customize the tabbar in iphone. It will do with four stripe of images.
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
NSUInteger selectedIndex = tabBarController.selectedIndex;
NSString *selectedImage;
switch (selectedIndex) {
case 0:
selectedImage = @"menu_selected.png";
break;
case 1:
selectedImage = @"location_selected.png";
break;
case 2:
selectedImage = @"offers_selected.png";
break;
case 3:
selectedImage = @"reviews_selected.png";
break;
default:
break;
}
UIImage *image = [UIImage imageNamed:selectedImage];
UIImageView *imageView = [[ UIImageView alloc ] initWithFrame:CGRectMake(0,440,320,40) ];
imageView.image = image;
[self.tabBarController.view addSubview:imageView];
}
Added: Source will do SKTabBar usage
Source: download
Tuesday, December 20, 2011
Restoration of backup SVN repository
The below steps executed in Snow Leopord OS:
SVN repo restoration steps in the existing environment:
- Copy your project repo under main repositiory directory in path /usr/local/main_repo/your_repo
- add/copy user in etc/users file if not exists
- add/copy authz group or user for the repo project in etc/authz
- verify all the paths in path etc/apache2/extra/httpd-svn.conf
Related:
For the New SVN setup details refer here.
Friday, December 16, 2011
Custom ScrollableTabBar (UIButtons) for iOS
One of my Project I need to build scrollable buttons/tab bar in the page. So, idea comes with this solutions.
How to call the SKTabBar class:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
CGSize buttonSize = CGSizeMake(50,60);
SKTabBar *skTB =[[SKTabBar alloc]initWithFrame:CGRectMake(0,100,320,100)];
[skTB setBackgroundColor:[UIColor grayColor]];
[skTB setShowsVerticalScrollIndicator:NO];
[skTB setSkDelegate:self];
[skTB loadTabs:buttonSize numberOfTabs:36];
[self.view addSubview:skTB];
[super viewDidLoad];
}
-(void)getSelectedButtonTab:(id)sender{
UIButton *btn = (UIButton*)sender;
NSLog(@"%d",btn.tag);
}
Updated:
Added animations code snippets to show the zoomed view of selected button on selection.
Source: download
Wednesday, December 14, 2011
How to build Static Library project in iOS
http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/#namespace_classes_appropriately
Video:
http://www.youtube.com/watch?v=fFn2o0aEbRQ
Tuesday, November 29, 2011
Unit test in iOS
Credit:
http://www.raywenderlich.com/3716/unit-testing-in-xcode-4-quick-start-guide
GHunit:
http://www.nearsoft.com/blog/printblog.html?index_php?view=article&id=305&tmpl=component&print=1
Handling Ultralite with Mobilink in iOS
Thursday, November 24, 2011
automatic reference counting
To read more...
Credit:
http://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html
Tracking Crash Logs
Credit:
http://iphonedevelopertips.com/debugging/locating-crash-reports.html
http://aplus.rs/apple/how-to-find-crash-logs-for-iphone-applications-on-mac-vista-and-xp/
Installing multiple XCode in mac
Please follow the steps while Installing xcode other than what you have now.
- Go to Root folder there will be a Developer folder for the existing XCode tool, create new folder with name Developer2
- While installing/configuring new XCode tool, one of the installation page show info about the disk/folder going to install by default. Please change the folder to Developer2
- Just continue other steps.
- That's all, two XCode is ready for development.
Note: Unable to change the default XCode.
Happy Coding.
xcode code analyzer
You can refer the below links to know better usage.
http://iphonedevelopertips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html
http://clang-analyzer.llvm.org/xcode.html
http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html
As of now Clang complier is not available for Xcode 4 (available for Xcode 3.2), it has the default LLVM GCC 4.2 complier. We may get that in future release, to know the error code message better.
Additional:
You must build your code using this Analyzer to fix the potential memory leaks and other issues.
http://clang-analyzer.llvm.org/xcode.html
If you are using,
Xcode 3: Build > Build and Analyze
Xcode 4: Select Product > Analyze.
Building multiple iPhone targets in XCode
Other case, if we are going to release 'lite' and 'full' version of the same product. We can customize our targets with the required resource based on the release type.
Credit:
http://www.pacificspirit.com/blog/2009/01/27/building_for_multiple_iphone_targets_in_xcode
iOS App Store Package (.ipa) option got disabled after archive
Credit:
http://stackoverflow.com/questions/5265292/xcode-4-create-ipa-file-instead-of-xcarchive
Related:
http://iphonedevelopertips.com/xcode/distribute-ad-hoc-applications-over-the-air-ota.html
Tuesday, November 22, 2011
setup svn in mac
Subversion, or “SVN” for short, is a development tool which is a versioned repository for your documents or code. It is allows you to maintain versions of files in an organized manner. Using SVN you can retrieve different versions of documents quite easily. Let’s take a look at how to set it up on Mac OS X Leopard.
- Let’s begin by installing SVN. There are a number of ways you can get and install SVN on your Leopard system. The easiest method, the one we will use here, is using XCode. XCode is a set of development tools that ship with your Mac. If you pop in the second DVD that came with your Leopard system, titled “everything else”. You will find the XCode 3 installer on this disk. Double click on it to install. In case you are unable to get your hands on the disc you can also download the XCode 3 installer from Apple’s website. You will, however, need to sign up for the Apple Development Connection program to be able to download XCode 3. The membership is free.
- Now let’s do a simple installation of SVN. Remember, this is a basic installation, without a lot of security. I’m assuming here that you are installing this on your machine for only you to use and will not open access to all. To do that you need to add a lot of security, which is beyond the scope of this article.
Here are steps we are going to follow:
- create a local SVN repository
- configure the Apache web server to work with SVN
- configure Apache to use the repository we created
- setup basic authentication for SVN
- Let’s create an SVN repository at the location ‘/usr/local/repo’. Launch the Terminal and execute the following command:
# sudo mkdir /usr/local/repo
At this point you will be prompted to enter your password. Enter the password you use for the user you are logged in as. Now create a new project called ‘testproject’ in SVN and under the directory we created earlier.
# sudo svnadmin create /usr/local/repo/testproject
We need to make sure that the Apache web server can read and write to this repository. So run the following command in the Terminal:
# sudo chown -R www /usr/local/repo
- We now need to configure the Apache web server to work with SVN. Follow the steps carefully, as we are going to be editing the configuration file used by Apache. If done wrong, this can break Apache. Open the Apache configuration file ‘httpd.conf’ in your favorite text editor, for example Vim:
Scroll down the document till you reach a section where you see a lot of instances of “LoadModule”. Create a new line at the end of this section using the ‘o’ key in Vim, and enter the following:
# sudo vim /etc/apache2/httpd.conf
Scroll down the document till you reach a section where you see a lot of instances of “LoadModule”. Create a new line at the end of this section using the ‘o’ key in Vim, and enter the following:
LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so
- Now we will add a separate configuration file for SVN. Scroll down to the end of the document and ad the following line:
Include /private/etc/apache2/extra/httpd-svn.conf
Save and exit the file. If you are using Vim then you need to use the following key combination, “ESC + ‘:wq!’ + Enter” to do that. Now open this file using Vim and let’s configure it.
# sudo vim /private/etc/apache2/extra/httpd-svn.conf
Enter the following into the file:
DAV svn
SVNParentPath /usr/local/repo# user authentication
AuthType Basic
AuthName “Subversion repository”
AuthUserFile /etc/users
# only authenticated users may access the repository
Require valid-user
- Now let’s setup a user for SVN. I’ll create the user calvin and assign him a password. This password protects our Subversion repository.
# sudo htpasswd -cm /etc/users calvin
New password:
Re-type new password:
Adding password for user calvinWe’re done now. Hit the url “http://localhost/repo/testproject” in your web browser. You should be prompted for a password here. Enter the username and password you just set. you should be in. You can now create more projects like we created “testproject”.
hudson integration for mac
- installing hudson : http://priyanka-tyagi.blogspot.com/2011/01/installing-hudson-on-mac-os-x-snow.html
- configuring hudson : http://www.manicwave.com/blog/2010/03/01/that-feels-better-cocoa-hudson-and-running-green/
- auto startup in mac (if req): http://jrenard.info/blog/a-quick-but-working-startup-item-for-hudson-for-mac-os-x.html
- command line parameter for xcodebuild: http://www.manpagez.com/man/1/xcodebuild/
FTUtils animations
Credit:
http://iphonedevelopertips.
Print Preview / Report in iOS
Using libHaru (open source), we can dynamically generate the pdf file with multiple pages for the print report.
Even adding images, drawing lines, and inserting text , etc.
Reference:
https://github.com/bygreencn/iPhonePDF#readme
Any issues in setup libHaru:
http://kishorek.com/2011/05/iphone-libharu-pdf-project-setup-xcode-3-2/
Used in my POC, samples attached.
global ignores
Here is the solution. We can commit any file or ignore unwanted file by configuring a file.
Follow the steps:
1. Right click finder icon > Goto Folder > type "~/.subversion" > Go
2. Edit the config file (Take backup before editing).
3. Search for this line: # global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.pyc *.pyo *.rej *.a *~ #*# .#* .*.swp .DS_Store *.zip
4. Remove the "*.a" and Save.
5. That's all, now you are ready to commit library files.
Credit:
http://stackoverflow.com/questions/2394363/svn-wont-import-a-library