background preloader

iOS

Facebook Twitter

How To Use Blocks in iOS 5 Tutorial – Part 2. This post is also available in: Chinese (Simplified) If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! This is a blog post by iOS Tutorial Team member Adam Burkepile, a full-time Software Consultant and independent iOS developer.

Check out his latest app Pocket No Agenda, or follow him on Twitter. Order up some Storyboards and Blocks in this tutorial! Welcome back to our tutorial series on using blocks in iOS 5 – with some Storyboard/Interface Builder practice along the way! In the first part of the series, we used iOS 5.0 Storyboards to set up the view and wound up with a nice-looking interface, close to what you see to the right. In this second and final part of the series, we finally get to blocks! We’ll show you how you can use blocks with NSArrays, for UIView animations, Grand Central Dispatch, and much more! So unblock your schedule and keep reading for some blocks practice and fun!

Getting Started: An Intro to Blocks YOU! Poof! Bbum's weblog-o-mat » Blog Archive » When is a Leak not a Leak? Using Heapshot Analysis to Find Undesirable Memory Growth. The other day, I was in need of a Cocoa application that launches quickly that has a standard document model. At random, I chose the rather awesome Hex Fiend. As I often do, I also had top -u -o pid running in a Terminal window. And I noticed something odd. As expected, the RPRVT of Hex Fiend was growing on each cmd-n.

However, the RPRVT was not decreasing the same amount every time I hit cmd-w. That ain’t right. In this case, the issue looks like a simple memory leak. . % leaks "Hex Fiend" leaks Report Version: 2.0 Process: Hex Fiend [3435] Path: /Volumes/Data/Applications/Hex Fiend.app/Contents/MacOS/Hex Fiend Load Address: 0x100000000 Identifier: com.ridiculousfish.HexFiend Version: 2.0.0 (200) Code Type: X86-64 (Native) Parent Process: launchd [122] Date/Time: 2010-10-16 20:47:09.935 -0700 OS Version: Mac OS X 10.6.4 Report Version: 7 Process 3435: 22980 nodes malloced for 2600 KB Process 3435: 0 leaks for 0 total leaked bytes.

To use: I ended up with the data as seen to the left. OK. Rules to avoid retain cycles. Memory Management All memory in a computer program must be allocated before it can be used and if you want to reuse that memory later for another purpose, it must be deallocated when you are done with it. In garbage collected environments, programmers don't need to handle the allocation and deallocation themselves; the allocation, retaining, releasing and deallocation are handled automatically — but these steps still occur. Unfortunately, this automatic work is CPU and memory hungry; garbage collection is slower and takes more memory than manual memory management. So, on the iPhone and in performance critical Mac OS X applications, we still have to handle memory management ourselves and that means methodically following the rules of Objective-C memory management: If you want to "own" an object, you must alloc, copy or retain it.Always release or autorelease when you are done with an object.

Object hierarchies and retain cycles Notice that the term "weak pointer" is used. So, either: or. WebService [How-To] Since that webservice is a hot topik on the forum, I decided to write a guideline to understand what you can do when you need to use webservice from iOS (so iphone or ipad or ipod, etc...) Section 1: About Webservice Section 2: REST webservice Section 3: SOAP Webservice Section 4: HTTP Request Section 5: Parse XML Section 6: Parse JSON In the first Section we will see some basic things about webservice, in Section 2 and 3 we will see 2 important architectures of webservice and how we can use these. In section 4 we will see some example to communicate with webservice, and in section 5 and 6 we will see how we can use what the webservice return. Section 1: About Webservice What is a WebService? Basically is a server that expose methods, you can call these methods with an input and you will receive an output.

A webservice can be written in any language (php, C#, VB.Net, Java, Python, etc...). Php web service example MySQL. iPhone Tutorials. How to Write an iOS App That Uses a Web Service. If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Web Services + iPhone Apps Rule! As an iOS developer, you often need to use a web service from your app. Sometimes you need to use a web service that someone else has written, and sometimes you need to use one of your own! In this tutorial, you’ll get hands-one experience with using web services, by writing an iOS app that communicates with a simple web service that allows you to redeem promo codes to unlock extra content.

This tutorial is the second and final part of a two part series on custom web services. You don’t necessarily have to set up the web service yourself for this tutorial – you can use the one I’ve already set up if you’d like. This tutorial assumes you have basic familiarity with programming for iOS. The Choice This tutorial requires you to create a new View-based application and integrate three frameworks into it: the JSON framework, ASIHTTPRequest, and MBProgressHUD.

How To Write A Simple PHP/MySQL Web Service for an iOS App. If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Web Services Rule! As an iPhone/iPad developer, it can be really useful to be able to write your own simple web services that integrate with your apps.

For example, you may wish to display some news updates that come from your web server, and display it on startup. Or perhaps store some user data “in the cloud”. Your imagination is the only limit! In this first tutorial in this two-part series, you’ll go step-by-step through the process of creating a simple web service, based on a promo code system I included in my latest app, Wild Fables. To run through all of the steps on this tutorial, you’ll need a web server with MySQL and PHP. You don’t necessarily need to know PHP or MySQL to go through this tutorial (although it will be helpful!)

What You’ll Make However, it can be extremely helpful to build your own promo code system for your in-app purchases, for several reasons: OK! iPhone SDK CoreData Debugging Error 1560 & 1570 | Design Code Execute. August 28th, 2009 | CoreData, Debugging, iPhone Apps, iPhone Development One of my CoreData applications started acting buggy, and was spitting out a huge error dump on app close in the debug console. The errors spitting out didn’t tell me anything but CoreData Error 1560 and 1570. Upon inspection I found on google that another layer of errors is stored in the CoreData foundation.

On Stack OverFlow found a very useful function but re-wrote it because ! [[survey managedObjectContext] save:&error] was causing an error. Add this into you applicationWillTerminate function in your Application Delegate The original post can be found here The cause of Error in my CoreData Application was an Attribute in my xcdatamodel file. Parade of Rain » Blog Archive » Taking the pain out of ad-hoc testing. This post is more of a public service announcement. Prior to Tilt to Live’s Game Center/Retina update we wanted to extensively test the game with a wider tester base. So we ran a small ‘open beta’ (as open as Apple’s ad-hoc program would allow us).

Prior to iOS 4.0 users had to do a cumbersome dance to get an ad-hoc game on their devices. And by cumbersome, I mean anything dealing with the desktop iTunes client. There was a lot of room for error, and for those (like me) that loathe syncing with iTunes, it creates a barrier because the act of adding an ad-hoc pretty much wipes my personal device since I buy all my apps 100% on the device and never sync. Enter iOS 4.0. With the new iPhone iOS 4, you can distribute apps wirelessly without iTunes intervention.

The benefit? The other upshot? Another good thing is we were able to get some ‘field data’ on our Game Center implementation. Downsides? A quick guide to build a wireless distro game or app 1. 2. 3. 4. 5.

iPad and Healthcare Security

iPhone Sticky Pad — UI Stencils. Post your ideas on the wall with our iPhone Sticky Pad. Group and arranging them. These are great for creating flows and architecture. Works for both horizontal and vertical apps. Alternatively, just leave someone a good-looking note. - 4"X9" Pads, 50 sheets each - White Paper - Works perfectly with our iPhone Stencil Kit The iPhone Stencil Kit, HiTec Pens and Copic Markers are sold separately. x1 - $9 The Weekender x3 - $25 The EsquireSave 10%x5 - $36 The EliteSave 20%

Michaeltyson/TPKeyboardAvoiding - GitHub. Tutorial for adding UIToolbar above UIKeyboard with Next, Previous and Done buttons in iPhone SDK. 7 Help: Shortcuts for taking pictures of the screen. Reality Browser - iPhone 5.0. Adding Local Notifications with iOS 4 - Blog. The Apple Push Notification Service (APNS) was released way back in iOS 3.0. That was only just over a year ago but given the pace of development in the mobile OS market that now seems like ancient history. APNS was a first tentative attempt by Apple to address the demand for background processes.

It allows client applications to receive updates from a server without having to be running. Apple takes care of pushing the notification to the device and the user can then decide whether to launch the application or not. Local Notifications The big problem with APNS is that it requires you to run a server somewhere that interacts with APNS to push a notification to a device.

For applications that already have a client-server architecture such as an IM client this is no big deal. The release of iOS 4 brought a number of new features aimed at adding multitasking support one of which was local notifications. The Example App – RemindMe Creating a Local Notification Cancel existing notifications. Red and White Pearl Download Icon. Here we’re going to create the download icon from the red and white pearl icons series at IconsETC. You can get additional social media icons in this style on Webtreats:108 Red & White Pearl Social Media Icons Create a new document 400px * 400px with 72dpi and a white background as seen below. To create the base of the icon first activate the shape tool by pressing U. Make sure the ellipse shape tool is selected then draw out a circle similar to the one shown below. TIP “Hold the shift key down while dragging to maintain the correct proportions and hold down spacebar to reposition” Activate the layer styles pallet by double clicking on the layer you just created or by going to LAYER >> LAYER STYLE >> BLENDING OPTIONS in the menu.

Now above the pearl layer create a new layer by going to LAYER >> NEW >> LAYER in the menu. Rotate the arrow you just created by 90% by going to EDIT >> TRANSFORM >> ROTATE >> ROTATE 90 CW. That’s it! You should now have something like what you see below. Iphone - Can't figure out cause of EXC_BAD_ACCESS with Core Data. 12 programming mistakes to avoid. By Peter Wayner December 6, 2010 06:15 AM ET "Having worked on one code base for three-plus years, my biggest regret is not making the code more modular," Subelsky says.

"I've learned the hard way why the Single Responsibility Principle is so important. I adhere to it strongly in new code, and it's the first thing I attack when refactoring the old code. " Subelsky, as you may surmise, is a Ruby on Rails programmer. Mistake No. 4: Delegating too much to frameworks Sometimes the magic tools lead only to confusion.

G. "Convention, by definition, is something outside the code," Meike says. He finds that reading the code often means keeping a manual close by to decipher what the code is doing behind his back. "The rules are, while quite reasonable, not entirely trivial. To make matters worse, the frameworks can often leave you, and any who come after you, stranded with pretty code that's difficult to understand, revise, or extend. Mistake No. 5: Trusting the client. iPhone: Logging to a file. Quick Tutorial on how to add MFMailComposeViewController. This process is fairly simple. The SDK includes the MessageUI.framework which simplifies this process to a few lines of code; don't know why you would want to send an email from the iPhone in another way. 1. Create a new View-Based Application and name it MailTutorial. 2. 3. #import <UIKit/UIKit.h>#import <MessageUI/MessageUI.h>#import <MessageUI/MFMailComposeViewController.h>@interface MailTutorialViewController : UIViewController <MFMailComposeViewControllerDelegate>{}- (IBAction)actionEmailComposer;@end Here we need to import Now, the IBAction class method named actionEmailComposer is what’s important. 4.

Here we added the IBAction method code. If the device is able to send emails, we created mailViewController by initializing and allocating MFMailComposeViewController and delegating the mailComposeDelegate to self. To set the subject and body of the e-mail message, we used the setSubject and setMessageBody instance method. I set the isHTML for the message body to NO.

Logging to a file on the iPhone. How to export data to a csv file with iPhone SDK 3.0. Multiple Xcode targets and info.plist - Blog. Another Xcode tip that I use a lot prompted by a question on StackOverflow. When I have an Xcode iPhone OS project that requires multiple targets I like to create a directory for each target under the resources group. I can then place any target specific assets such as icons, data and the Info.plist file in one place. This helps a lot when it comes to selecting which items are included in which target build. Note that the location of the Info.plist file needs to be set for each target in the build settings for the target (right-click on the target, get info and then look in the packaging section of the build tab). A common and easy mistake to make when selecting which files are included with each target is to select the Info.plist file. Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'Resources/AppTarget1/Info.plist' If you are building for a device the codesign operation will also fail: Command /usr/bin/codesign failed with exit code 1.

Building for multiple iPhone targets in XCode - Dave Orchard's Blog. I've been exploring building for multiple iPhone targets using XCode. The goal is to keep the common code across targets in one place, rather than cutting and pasting. It's pretty straightforward and also very customizable. A very interesting technique is using #if TARGET macros to control execution... {*style:<b>Interationalization </b>*}A very common reason for multiple targets is multiple locales. The easiest is to make sure that all the strings are in local-specific files.

Another common need is for different target names. I really wanted to have some files remain the same because most of the functionality was common. It turns out to be really easy to set objective-c macros for compile time. Then in your code you can do #if TARGET_NAME == myApp #elif TARGET_NAME == myAppLite #endif This has the nice advantage that your runtime code will be smaller and faster than a runtime check.

Tip: if you want to see all the #defines for your files, set the OTHER_CFLAGS to "-g3 -save-temps -dD" The iPhone app is the Flash homepage of 2010. 33 ways to make your app a hit: VentureBeat’s Discovery Directory. Localization Guide for iPhone Applications, built with Apple Xcode. Rcarlsen's Pocket-OCR at master - GitHub. Exploration » Pocket OCR. Exploration » Blog Archive » cross-compiling for iPhone dev. 17467-compile-c-code-iphone. Tesseract: an Open-Source Optical Character Recognition Engine. Royalty Free Icons & Clipart Stock Images.

Tab Bar Icons (part 2) Top 5 iOS Data Backup & Syncing Solutions. Sliding UITextFields around to avoid the keyboard. How to share a ManagedObjectContext when using UITabBarController. Get to the point: Tab Bar Application – Adding an UITableView to a Navigation Controller « init 6. RSS Reader (Part 4): Setting up the UITabBar and UITableView with delegates | dBlog.com.au.