»
S
I
D
E
B
A
R
«
In-App SMS in iPhone OS 4.0
Aug 12th, 2010 by Anish Kumar

With iPhone OS 4.0 and above we can send SMS right from within our application. Now our application can invoke the SMS composer screen just like we invoke the Mail composer screen. We need to invoke an instance of MFMessageComposeViewController and assign the delegate, recipients and body of the SMS. The code snippet is provided below:

Read the rest of this entry »

Problem With FBDialog Cancel Button
Jul 21st, 2010 by Anish Kumar

The FBConnects’s FBDialog class has a problem with the cancel button. When user taps the cancel button, the delegate method “dismissWithSuccess” is called instead of “dialogDidCancel“. This flaw in the FBConnect SDK makes it difficult to determine whether the user has tapped on cancel button or not. We can overcome this issue by editing FBDialog.m in the FBConnect. Add the below code as the first line in FBDialog.m’s webViewDidFinishLoad : methods

[_webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('cancel').onclick = function onclick(event) { window.location.href = 'fbconnect:cancel'; }"];

This should fix the issue and dialogDidCancel should get called correctly..!

Uploading Images To Facebook Wall Using FBConnect
Jul 21st, 2010 by Anish Kumar

We can upload images to Facebook users wall using the following FBConnect code:

FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.delegate = self;
dialog.userMessagePrompt = "Image Upload Sample";
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Anish\","
"\"href\":\"http://www.macoscoders.com/\",\"description\":\"This is an example to upload image to FB\","
"\"media\":[{\"type\":\"image\","
"\"src\":\"http://www.macoscoders.com/images/anish.jpg\","
"\"href\":\"http://www.macoscoders.com/\"}],"
"\"properties\":{\"another link\":{\"text\":\"Home page\",\"href\":\"http://www.macoscoders.com/\"}}}"]];
[dialog show];

Make sure you have implemented the correct delegate methods for FBConnect to know the status of posting to wall
Cheers..!

Opening App Review Page Of App Store
Jun 7th, 2010 by Anish Kumar

If you would like to launch the app review page of your application so that its easier for your user to navigate there in the app store and write a good review to your app, here is the code snippet
Use this:


[[UIApplication sharedApplication] openURL:[NSURL URLWithString:
@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=YOUR_APP_ID&mt=8"]];

Replace YOUR_APP_ID with the application ID of your app.

Cheers…!

Tab Bar Icons
Jun 7th, 2010 by Anish Kumar

What are requirement of anicon for Tab Bar item ?

From Tab Bar Item class reference:

The item’s image: If nil, an image is not displayed. The images displayed on the tab bar are derived from this image. If this image is too large to fit on the tab bar, it is scaled to fit. The size of an tab bar image is typically 30 x 30 points. The alpha values in the source image are used to create the unselected and selected images—opaque values are ignored.


You can't use color images as only alpha values matter.

And then they changed the entire publishing industry..!
May 28th, 2010 by Anish Kumar

Are you a budding author who needs help?  Apple has just given you a way to get your masterpiece into the iBooks store for the iPad (and soon for iPhone with OS 4.0), and the best thing is  you can do it all yourself without ever knocking the doors of an publisher, distributor, agent or anything else for that matter. You, as an author can decide how much to charge and which countries to sell into. You  get the same deal as the iPhone/iPad app publishers( meaning that Apple takes 30% and you keep 70% of the revenue).

There are some requirements before you can successfully publish your book on the iBookStore:

  • Get an ISBN numbers for the books you want to publish
  • Convert the book into EPUB format
  • Make sure the book pass EpubCheck 1.0.5
  • a US Tax ID (sorry guys, this is only open to the US at this point)
  • an iTunes account backed up by a credit card Read the rest of this entry »
Adobe abandons iPhone code tools
May 11th, 2010 by Anish Kumar

Adobe has decided to stop developing software tools that allow Apple’s iPhone and iPad to use its popular Flash technology.

The decision reverses an earlier pledge in which it said it would help get Flash working on the gadgets.

Closed tools

In mid-April, Adobe released software  Creative Suite 5 that contained option to export Flash applications into native iPhone applications. Shortly before the release, Apple updated the terms and conditions of the license software developers must sign to create iPhone and iPad applications. The revised terms placed strict restrictions on what developers can use to create these applications and effectively banned them from using 3rd party tools such as Creative Suite 5.

At the time Adobe wrote that it still intended to deliver the feature. Now it has said it will halt development of future export tools for Creative Suite.

“We will still be shipping the ability to target the iPhone and iPad in Flash CS5,” wrote Mike Chambers, Adobe’s principal product manager for developer relations, on his blog. “However, we are not currently planning any additional investments in that feature.” Mr Chambers also commented on Apple’s revision of its terms and conditions. He wrote: “…as developers for the iPhone have learned, if you want to develop for the iPhone you have to be prepared for Apple to reject or restrict your development at any time.”

Apple responded in a statement to technology news site CNet in which it described Flash as “closed and proprietary”. Apple preferred to support more open standards which replicate everything Flash can do, added the statement.

Mr Chambers wrote that now Adobe will concentrate on Google’s Android smartphone software and ensure that its Flash technology works well with that. “Fortunately,” he wrote, “the iPhone isn’t the only game in town.”

Set Application Badge Number
Apr 13th, 2010 by Anish Kumar

To manually set the iPhone application icon badge value, use the following code snippet

[UIApplication sharedApplication].applicationIconBadgeNumber = 5;

Localizing Settings.bundle
Apr 12th, 2010 by Anish Kumar

For adding internationalization support to iPhone Settings.bundle, follow these steps:-
1. Close the Xcode IDE
2. Drag and duplicate the settings bundle onto the desktop (or wherever)
3. Open bundle contents by selecting “Show Package Contents” from the right click menu options
4. Drag Root.strings into the en.lproj folder
5. Duplicate the en.lproj folder and rename to whatever language you want (using 2-letter code. Eg: fr.lproj for French)
6. Replace the original settings bundle with the new one.
7. Open Xcode IDE and the new files and folders should be there
This methods works fine in the simulator and on my iPhone device.

New Features In iPhone OS 4.0
Apr 9th, 2010 by Anish Kumar

iPhone OS 4 is the next generation of the world’s most innovative mobile operating system. Its unique capabilities and new technologies will change what you thought was possible on a mobile platform. With a rich set of over 1500 new APIs, iPhone SDK for iPhone OS 4 provides you with an amazing range of technologies to enhance the functionality of your iPhone and iPod touch apps. iPhone Developer Program members can visit the iPhone Dev Center to download the iPhone SDK 4 beta now.

Multitasking

iPhone OS 4 delivers seven new multitasking services that allow your apps to perform tasks in the background while preserving battery life and performance. These multitasking services include:

  • Background audio – Allows your app to play audio continuously. So customers can listen to your app while they surf the web, play games, and more.
  • Voice over IP – Your VoIP apps can now be even better. Users can now receive VoIP calls and have conversations while using another app. Your users can even receive calls when their phones are locked in their pocket.
  • Background location – Navigation apps can now continue to guide users who are listening to their iPods, or using other apps. iPhone OS 4 also provides a new and battery efficient way to monitor location when users move between cell towers. This is a great way for your social networking apps to keep track of users and their friends’ locations.
  • Push notifications – Receive alerts from your remote servers even when your app isn’t running.
  • Local notifications – Your app can now alert users of scheduled events and alarms in the background, no servers required.
  • Task finishing – If your app is in mid-task when your customer leaves it, the app can now keep running to finish the task.
  • Fast app switching – All developers should take advantage of this. This will allow users to leave your app and come right back to where they were when they left – no more having to reload the app.

Read the rest of this entry »

Warning: The Copy Bundle Resources build phase contains this target’s Info.plist file ‘Resources/Info.plist’.
Mar 30th, 2010 by Anish Kumar

Some times we would like to move the info.plist to other directories than the default project root directory. In such cases XCode would throw warning like “Warning: The Copy Bundle Resources build phase contains this target’s Info.plist file ‘Resources/Info.plist’.”

The Info.plist file belongs directly inside of the bundles Contents folder — that is to say, one level up from the Resources subdirectory. Thus copying Info.plist to that would serve little purpose, and might even be evidence of programmer oversight on something (as Xcode might think), hence the warning.  The Info.plist should not actually be a member of any target. The check boxes in the Get Info window of the info.plist should be unchecked and this warning can be avoided.

Hope this helps..!

Error: “CGGStackRestore: gstack underflow”
Nov 2nd, 2009 by Anish Kumar

Today while I was working with some CoreGraphics API’s, I encountered a error which I was seeing it for the first time. CG for dumping an error “CGGStackRestore: gstack underflow” in the console everytime I invoked a method that was doing some CG based operations. Googling around I found that in CoreGraphics, you can save (CGContextSaveGState) and restore (CGContextRestoreGState) the graphics state. When the  state is saved, a copy is put on the graphics state’s “stack”, and when it is restored, the top state on the stack is removed and used. If we restore the state more times than we save it and then when we try to remove and use the top item of the stack, the stack is empty, causing a stack “underflow” error. So just make sure you have enough save-restore state methods called and it will fix the issue.

CGGStackRestore

CGGStackRestore

Coming Soon: Develop Native iPhone Application Using Actionscript
Oct 20th, 2009 by Anish Kumar

With Flash Professional CS5, we can now build applications for iPhone and iPod touch using ActionScript 3. These applications can be delivered to iPhone and iPod touch users through the Apple App Store. A public beta of Flash Professional CS5 with prerelease support for building applications for iPhone is planned for later this year. At MAX 2009, Adobe showed a number of applications and games for iPhone that have been built using a prerelease version of Flash Professional CS5. The tooling update allows developers to use Flash technologies to develop content for iPhone and iPod touch. Developers can write new code or reuse existing web content to build applications for iPhone. Because the source code and assets are reusable across the Flash Platform runtimes,—Adobe AIR and Flash Player—it also gives developers a way to more easily target other mobile and desktop environments.

Read the rest of this entry »

XCode Error: “Loading Stack Frames”
Oct 9th, 2009 by Anish Kumar
Xcode: Loading Stack Frames

Xcode: Loading Stack Frames

Recently I encountered an new error for the first time in XCode. When my iPhone application under development crashed, instead of showing me the stack trace of where the application crashed, it threw an error “Loading Stack Frames” and was struck there indefinitely.  After researching about this for a while, I came to know my application crashed because of a stack overflow due to a non-terminating recursion in your code, and gdb is now trying to load all the stack frames on the stack . Usually, the stack of a application doesn’t get deeper than 50 frames or so (and that’s already a quite deeply nested stack). My application stack had run into 104708 frames which was quite too high.I finally figured out that the crash was due to an race condition.

Customising UITableView: A nice article
Jun 25th, 2009 by Anish Kumar

One of my colleague found this nice article on the web which explains things we need to do and not to do to customize a UITableView and make it look great than a plain dump table.

http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

Error: “no valid ‘aps-environment’ entitlement string found for application”
Jun 23rd, 2009 by Anish Kumar

I got this error while building an iPhone application that is going to use APNS. I am still trying to figure out what is causing this problem. A more detailed error message is here:-

"Error Domain=NSCocoaErrorDomain Code=3000 UserInfo=0x113e80 "no valid 'aps-environment' entitlement string found for application"

APNS Error

APNS Error

XCode: Could Not Support Development
Jun 20th, 2009 by Anish Kumar
XCode: Could Not Support Development

XCode: Could Not Support Development

Today  when I started my work on an iPhone project, my XCode failed to mount my iPhone. The XCode organizer was showing an orange dot next to it instead of the usual green one. Organizer complained “Could Not Support Development”. I tried restarting my XCode, launched iTunes but in vain. iTunes was able to mount my iPhone but XCode simply failed and I was not able to test my app’s on my phone. Read the rest of this entry »

Error Starting Executable
Jun 18th, 2009 by Anish Kumar
Error Starting Executable

Error Starting Executable

Quite a few times in our iPhone application development cycle we would encounter XCode error “Error Starting Executable – No provisioned iPhone OS device is connected.” even when we know the device is connected to the machine.   This error occurs when the connected device is not configured in the XCode->Organizer. Organizer would fail to mount the device as the version of XCode installed on the developer machine may not support the version of iPhone OS installed on the device.

Read the rest of this entry »

Add Background Image To UIView
Jun 11th, 2009 by Anish Kumar

If you ever need to add a image as background for an UIView then do it like this (Make sure the image is in your app’s resource bundle):-

- (void)viewDidLoad
{
    self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"MyBackground.png"]];
}
My First Post Using Wordpress For iPhone
Jun 8th, 2009 by Anish Kumar

This is my first post using iPhone 3.0 Wordpress application. This is awesome cool in that now I can blog when I am travelling. I will write more about this app as I begin to use more of it.

the first feedback would be I am missing all the formatting options that I take for granted on desktop version of wordpress.