Author Archives: langui - Page 7

iPageRank Released

iPageRank is a handy tool for checking website Google PageRank on your iPhone/iPod Touch, anytime and anywhere.

iPageRank home page: https://langui.net/ipagerank/

iPageRank is available on iTunes App Store for free:

https://itunes.apple.com/us/app/ipagerank-pagerank-checker/id433671401?mt=8

How to “add existing frameworks” in XCode 4

Here is the step by step instructions:

  1. In the project navigator, select your project
  2. Select your target
  3. Select the ‘Build Phases’ tab
  4. Open ‘Link Binaries With Libraries’ expander
  5. Click the ‘+’ button
  6. Select your framework
  7. (optional) Drag and drop the added framework to the ‘Frameworks’ group

Original: https://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4

cannot decode object of class (MKMapView)

Problem:

*** Terminating app due to uncaught exception ‘NSInvalidUnarchiveOperationException’, reason: ‘*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (MKMapView)’

Solution:

add the “MapKit.framework” library.

How to enable “swipe to delete” for UITableViewCell

- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
// No editing style if not editing or the index path is nil.
if (self.editing == NO || !indexPath) return UITableViewCellEditingStyleDelete;
}

Server certificate verification failed

Got the following issue when trying to commit changes to SVN server:

svn: OPTIONS of ‘https://langui@langui.net/svn/MyProject/trunk/src’: Server certificate verification failed: certificate issued for a different hostname, issuer is not trusted (https://langui.net)

I’m using svnX, and it seems there is no way to get around this issue. I searched the web but found no solution.

Finally, I tried to update the svn working copy in terminal:

$ svn up

Error validating server certificate for ‘https://langui.net:443’:

– The certificate is not issued by a trusted authority. Use the

fingerprint to validate the certificate manually!

– The certificate hostname does not match.

Certificate information:

– Hostname: langui-server

– Valid: from Wed, 20 Apr 2011 15:08:48 GMT until Thu, 19 Apr 2012 15:08:48 GMT

– Issuer: langui.net

– Fingerprint: e6:52:b9:b6:f2:35:68:6c:cd:93:ef:b2:f3:15:02:dd:85:2b:1f:28

(R)eject, accept (t)emporarily or accept (p)ermanently? p

At revision 49.

Then try agin with svnX, it works!

Xcode warning: No provisioned iOS devices are available

I got this warning when trying to deploy my App into my iPhone 4: “No provisioned iOS devices are available. Connect an iOS device or choose an iOS simulator as the destination.”

After some googling I found the answer: the default target was set to 4.3 but my iPhone iOS version is 4.2.

I edited the target and set “Base SDK” to “iOS 3.2”, then everything is ok.

Seems it’s time to update my iPhone now.

Why “shouldAutorotateToInterfaceOrientation” doesn’t Work

The following is from Apple’s Technical Q&A:

  • All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set.
  • Overriding the -(id)init: or -(id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle method without calling super. For the object to be initialized properly, you must call super on any init or initWithNibName method you are overriding for your view controllers.

For more detail please see:

Why won’t my UIViewController rotate with the device?

How to make iPhone app icon without borders

Open up the project in Xcode, open the Info.plist file, add a new row and choose “Icon already includes gloss and bevel effects” and checkmark it (set to true).

The original solutions can be found here:

http://forums.macrumors.com/showthread.php?t=747874

Get a list of the languages that iPhone supports

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSLog(@"%@", languages);

NSMutableArray count always returns zero

The code is as follows, rowsToUpdate is NSMutableArray *, [sites count] is greater than 0, and there is value for row index, but [rowsToUpdate count] always returns 0:

	for (int i=0; i<[sites count]; i++) {
		NSLog(@"row index: %i, %@", i, [NSString stringWithFormat:@"%i", i]);
		[rowsToUpdate addObject:[NSString stringWithFormat:@"%i", i]];
		NSLog(@"[rowsToUpdate count] = %i", [rowsToUpdate count]);
	}

There is no obvious problem with the code, and it doesn’t make sense to return 0.

After a couple of search, I found it on stackoverflow.com that I missed the initialization for “rowsToUpdate”. The fix is as follows (a couple lines of code added):

	if (rowsToUpdate == nil) {
		rowsToUpdate = [[NSMutableArray alloc] init];
	}
	else {
		[rowsToUpdate removeAllObjects];
	}

	for (int i=0; i<[sites count]; i++) {
		NSLog(@"row index: %i, %@", i, [NSString stringWithFormat:@"%i", i]);
		[rowsToUpdate addObject:[NSString stringWithFormat:@"%i", i]];
		NSLog(@"[rowsToUpdate count] = %i", [rowsToUpdate count]);
	}