• Fix “No architectures to compile” error

    if you ever face the below error while trying to build a iOS project
    “No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=i386, VALID_ARCHS=armv6 armv7).”

    Then try this:

    Project Build Settings:

    Architectures: Standard (armv6 armv7)
    Base SDK: Latest iOS Build Active
    Architectures Only: Checked Valid
    Architectures: armv6 armv7

    Make sure you delete an sub settings in the Architecture build setting.

    Target Build Settings:

    Same at project settings.

    Clean all targets and try building the project again

     
  • Supporting both Retina Display and Normal Display

    With iPhone 4.0 SDK, all graphics/images are automatically scaled (including coordinates) according to the device screen resolution. All we have to do is provide two versions of each image used in our application – one to suit for the retina display, other one suit to normal resolution. All images that needs to be rendered for retina display must have a “@2x” in the filename (just before the file extension). If the device uses retina display, it will automatically load the @2x file, otherwise it will load the normal file and scale it up.

     
  • In-App SMS in iPhone OS 4.0

    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

    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

    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..!

     
  • Set Application Badge Number

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

    [UIApplication sharedApplication].applicationIconBadgeNumber = 5;

     
  • Localizing Settings.bundle

    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

    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 »

     
  • Coming Soon: Develop Native iPhone Application Using Actionscript

    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”

    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.

     
  • Apple releases iPhone OS SDK 3.1.2

    Apple on Thursday released an update for the iPhone SDK, bringing the current version of the SDK to 3.1.2.

    The new SDK 3.1.2, which now includes Xcode 3.2.1, is available in versions that are compatible with Leopard and Snow Leopard for iPhone and iPod Touch developers.

    The update contains general bug fixes for the SDK and Xcode. Dashcode is reported to now support the creation of Web applications that are optimized for Safari on the iPhone, PC, and Mac.

    If you’ve used this new update, please tell us about your experiences with it in the comments.

     
  • Best Practices For Creating Video For iPhone

    Safari supports audio and video viewing in a webpage on the desktop and iPhone OS. You can use audio and video HTML elements or use the embed element to use the native application for video playback. In either case, you need to ensure that the video you create is optimized for the platform and different bandwidths.

    iPhone OS streams movies and audio using HTTP over EDGE, 3G, and Wi-Fi networks. iPhone OS uses a native application to play back video even when video is embedded in your webpages. Video automatically expands to the size of the screen and rotates when the user changes orientation. The controls automatically hide when they are not in use and appear when the user taps the screen. This is the experience the user expects when viewing all video on iPhone OS.

    Read the rest of this entry »

     
  • Customising UITableView: A nice article

    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”

    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

    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

    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

    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

    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.

     
  • Error: The executable was signed with invalid entitlements

    Sometimes when we are installing applications to our device through XCode, we might get a error message saying “The executable was signed with invalid entitlements“. This is most likely because the device is not included in the provision file. In tried with a device which i was sure to be included in the provision file and found that it works as expected. This error mostly occurs when we try to install applications on device which are not included in the provision file and is running iPhone OS 3.0. My iPod Touch whose UDID was not in the provision file was throwing this error where as my iPhone whose UDID is included in the provision file worked fine.

    If you come across anyother reasons for getting this error message, do let me know.

     
  • How to set badge value of an TabBar Item

    Many iPhone projects would require setting some numeric value on tabBarItem called badge. We can set the badge value for a tabBarItem by:-

    Fig: UITabBarItem With Badges

    Fig: UITabBarItem With Badges

    //__tabBarController  is a outlet to our UITabBarController
    __tabBarController.selectedViewController.tabBarItem.badgeValue = @”1″;
    The badge value expects an string and it should be an integer. The maximum width of the badge is around 58 pixels in which approximately 7 to 9 digits fit in depending on the digits being displayed.
    Too Many Digits In Badge

    Too Many Digits In Badge

     

Bad Behavior has blocked 236 access attempts in the last 7 days.

array(0) { }