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 »
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
dismissWithSuccess
dialogDidCancel
webViewDidFinishLoad :
[_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..!
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..!
To manually set the iPhone application icon badge value, use the following code snippet
[UIApplication sharedApplication].applicationIconBadgeNumber = 5;
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.
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.
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:
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.
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 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.
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.
audio
video
embed
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.
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
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
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
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.
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"]]; }
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.
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.
The executable was signed with invalid entitlements
If you come across anyother reasons for getting this error message, do let me know.
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
Too Many Digits In Badge
Apple’s has announced a push notification service for the iPhone that it’ll provide to all developers. It’ll maintain a persistent IP connection to the phone and let a 3rd party server ping Apple’s notification service in order to push out notifications to users device, which can be in the form of badges, sounds or custom textual alerts. According to Apple, the service will preserve battery life and maintain performance, not to mention work over WiFi or cellular.
We can use the UITextField’s delegate method
- (BOOL)textField: (UITextField *)textField shouldChangeCharactersInRange: (NSRange)range replacementString: (NSString *)string
to set the maximum character length.
This can be done by doing the following:
#define MAX_LENGTH 10 - (BOOL)textField: (UITextField *)textField shouldChangeCharactersInRange: (NSRange)range replacementString: (NSString *)string { if (textField.text.length >= MAX_LENGTH && range.length == 0) { return NO; } else { return YES; } }