I've always been intertested in "fonts", so one of the first things to do after installing iPhone 4.2.1 was to checked available fonts. Don't know about others, but I'm pretty sure Apple Color Emoji wasn't in previous iOS version! Now I'm wondering about the others...
Sunday, November 28, 2010
Thursday, November 25, 2010
Accessing Unknown 'cornerRadius' Component of a Property
Wanted to create rounded corners for a component, done this before in another project. Suddenly it doesn't work any more:
button.layer.cornerRadius = 8.0f;Forgot to include header:
#import <QuartzCore/QuartzCore.h>Error code kind of hinted in that direction, I guess... Wasn't very obvious. Btw check that CoreGraphics.framework is already included in project.
Tuesday, November 23, 2010
UIActionSheet Last Button Not Responding
Your UIActionSheet's bottom button, most likely Cancel, is not responsing to tap.
Check whether there is a UITabBar or UIToolbar below it. The problem is that most likely you try to show actionSheet as subview of your current view, which starts only above tabs and toolbar. However since actionSheet is always shown attached to bottom of the screen, you will miss taps outside your view.
Check whether there is a UITabBar or UIToolbar below it. The problem is that most likely you try to show actionSheet as subview of your current view, which starts only above tabs and toolbar. However since actionSheet is always shown attached to bottom of the screen, you will miss taps outside your view.
Xcode 3.2.5 Base SDK Missing
Downloaded Xcode 3.2.5 and iOS SDK 4.2, installed and opened an old project. Got error note Base SDK Missing, as expected. Nothing to worry about!
Select project, press Command-i to view project info, find Build - Architectures - Base SDK and select the new "Latest iOS (currently set to iOS 4.2)". Close info - and nothing happens!
Select Targets and your application, press Command-i to view target info. You might have overwritten default project settings by mistake earlier. Check what is Build - Architectures - Base SDK. Should be same as you just defined for project. Close info - and nothing happens!
Close Xcode, reopen your project - and Base SDK is set! Didn't really expect this kind of new features with the update...
Update: No need to close Xcode, just toggle some settings via "Overview" popup at top left corner. For example change "Active Configuration" to Release and back to Debug. Usually that's enough, though sometimes target device has changed, too. Verify all "Overview" selections after you've done this.
Select project, press Command-i to view project info, find Build - Architectures - Base SDK and select the new "Latest iOS (currently set to iOS 4.2)". Close info - and nothing happens!
Select Targets and your application, press Command-i to view target info. You might have overwritten default project settings by mistake earlier. Check what is Build - Architectures - Base SDK. Should be same as you just defined for project. Close info - and nothing happens!
Close Xcode, reopen your project - and Base SDK is set! Didn't really expect this kind of new features with the update...
Update: No need to close Xcode, just toggle some settings via "Overview" popup at top left corner. For example change "Active Configuration" to Release and back to Debug. Usually that's enough, though sometimes target device has changed, too. Verify all "Overview" selections after you've done this.
Sunday, November 21, 2010
How to Disable Copy, Paste and Select for UITextView
Need to use UITextView, but don't want Copy, Paste and Select feature. How to disable that? Tried overwriting canPerformAction:withSender but I got still a flash of quickly disappearing popup menu and selection.
Subclass UITextView and overwrite canBeforeFirstResponder to return always NO:
Subclass UITextView and overwrite canBeforeFirstResponder to return always NO:
@interface MyUITextView : UITextViewNow you have completely hidden and disabled copy, paste and select for UITextView!
@end
@implementation MyUITextView
- (BOOL)canBecomeFirstResponder
{
return NO;
}
@end
Labels:
canBecomeFirstResponder,
interface,
subclass,
UITextView
Friday, November 19, 2010
Why Doesn't Repeating NSTimer Invalidate
Most likely your timer is started more than once. If you can't find why that happens (or is done by iOS for unknown reasons), easy and safe fix is to invalidate your timer just before you create it:
[self.myTimer invalidate];You can call [nil method] without problems in iOS.
self.myTimer = nil;
self.myTimer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(updateTime)
userInfo:nil
repeats:YES];
Tuesday, November 16, 2010
Code Sign error: Provisioning profile can't be found
Check what is Info.plist Bundle Identifier, go to Apple iOS provision portal and download related App ID provision file and install. Note that if you're not Team Admin, you have to ask someone else to download the file for you.
Actual error code shows also cryptic mobileprovision id, but that won't help you much:
Actual error code shows also cryptic mobileprovision id, but that won't help you much:
Code Sign error: Provisioning profile '123456F8-1234-1234-ABCD-ABCDEFGH1234' can't be found
The executable was signed with invalid entitlements (install)
This is not the error with EXACTLY same error note you get during ad hoc release creation in Xcode (see here). This one comes, when you try to install that "successfully" created ad hoc release into device.
OPEN, no idea what went wrong or how to fix. Yet.
OPEN, no idea what went wrong or how to fix. Yet.
Code Sign error: The identity 'iPhone Developer' doesn't match any identity in any profile
Your developer certificate is missing, download and install from apple dev website:
- Revoke, request new, remove old stuff from Keychain Access, install new
- Create new Development Provisioning profile with new cert, download and install
Team Provisioning Profile - Invalid. Renew button disabled
Team Provisioning Profile - Invalid. Renew button disabled.
Open Xcode Organizer, find Team profile and press Renew button. Automatically downloads Team Provisioning Profile, but only for apps with * App ID.
Open Xcode Organizer, find Team profile and press Renew button. Automatically downloads Team Provisioning Profile, but only for apps with * App ID.
Monday, November 15, 2010
Everything That Can Go Wrong With Xcode Build and Release
Right now I'm in the middle of serious mess up of my Xcode development environment, can't create ad hoc builds. No idea what triggered it, thus no idea what or how to fix. Since same error notes keep popping up time after time, I start documenting each. Maybe I'll slowly gather enough info to fix something.
Xcode error notes:
You have sympathy. It won't help either.
Xcode error notes:
- The executable was signed with invalid entitlements (Xcode)
- The executable was signed with invalid entitlements (install) OPEN
- Command /usr/bin/codesign failed with exit code 1
- Build & Archive - Share Application - nothing happens
- Build & Archive - Share Application - unable to find user OPEN
- Build & Archive - Share Application - Email - missing plugin OPEN
- Team Provisioning Profile - Invalid. Renew button disabled.
- Code Sign error: The identity 'iPhone Developer' doesn't match any identity in any profile
- Code Sign error: Provisioning profile can't be found
- Apple Technical Note TN2242: Resolving "0xE800003A", applications not launching and "missing entitlement"
- Cocoanetics: A signing identity matching this profile could not be found in your keychain
- Apple Developer Forums
- Stack overflow
You have sympathy. It won't help either.
Labels:
adhoc,
build,
certificate,
debug,
distribution,
provisioning,
warning
Build & Archive - Share Application - CSSMERR_TP_NOT_TRUSTED
Build & Archive - Share Application and both Email and Save fail without any visible error note. You seem to have been simply ignored. Try again to be totally ignored.
Possible error notes you can find from Console application - Databases searches - Console Messages:
Possible error notes you can find from Console application - Databases searches - Console Messages:
- Command /usr/bin/codesign failed with exit code 1
- CSSMERR_TP_NOT_TRUSTED
Command /usr/bin/codesign failed with exit code 1
Select your project root in Xcode, command-i for Info, go to Configurations tab, delete old "Ad Hoc" configuration, duplicate Release and rename as "Ad Hoc". Rebuild and i installs and runs on connected device.
Problem might have been due space in name (even when it used to work earlier).
Problem might have been due space in name (even when it used to work earlier).
The executable was signed with invalid entitlements
Try to create ad hoc release in Xcode, got error note:
Case 2: make sure you have Entitlements.plist file in your project, containing just one prorerty called get-task-allow". This has to be off. Add name of this file into your project ad hoc release Code Signing Entitlements.
The executable was signed with invalid entitlements.Case 1: Go to Provisioning Portal - Provisioning - Distribution, find your project Distribution Provisioning Profile, Edit - Modify (do whatever and revert if everything already is right) - Submit - Download and double-click the file at your dev machine. Clean and rebuild.
The entitlements specified in your application's Code Signing Entitlements file do not matchc those specified in your provisioning profile (0xE8008016). [OK]
Case 2: make sure you have Entitlements.plist file in your project, containing just one prorerty called get-task-allow". This has to be off. Add name of this file into your project ad hoc release Code Signing Entitlements.
Labels:
debug,
distribution,
entitlements,
provisioning,
signing,
warning,
Xcode
Thursday, November 11, 2010
How to Undo Past Last Point
This is one of those things you do only once, thus easily forgotten. Did it for "my" machine, but now I'm a contractor using customer machine.
So how do I get rid of this annoying warning note, when I want to undo after saving a file:
So how do I get rid of this annoying warning note, when I want to undo after saving a file:
You are about to undo past the last point this file was saved. Do you want to do this?Open Terminal window and type:
defaults write com.apple.Xcode XCShowUndoPastSaveWarning NORestart Xcode and you're fine. Until next machine.
How to Center UIImage On-Screen
Created dynamically an UIImageView with small UIImage at top left corner. Wanted it centered, but UIImage automagically resized UIImageView, which was by default stuck at that forementioned top left corner.
UIImage *image = [UIImage imageNamed:@"small.png"];There are several ways to fix this, some more complicated while some more difficult. Common thing is that they contain a lot of code to infest with bugs. However simple problems require simple solutions:
self.imageView = [[UIImageView alloc] initWithImage:image];
self.imageView.center = self.view.center;I'm too embarrassed to tell how much time I "invested" until I got to this solution. Let's just say that I learned a lot. Btw this code does not rotate. There are several ways to fix this...
[self.view addSubview:self.imageView];
How to Define UITableViewCell reuseIdentifier for loadNibNamed
When you create UITableViewCells, it's important to use reuseIdentified. This lets iOS recycle your table cells, thus improving performance and minimizing memory use. Using it is pretty simple:
Warning: you should NEVER access objects inside XIB (NIB) by magical index into array! Apple might change "something" in next Xcode release and thus break your code. You should use IBOutlets. You have been warned.
...yes, this is one of those sad "don't do as I do, but as I tell you to" cases...
static NSString *idCell = @"MyCellId";Try to reuse an already existing, but not currently used, cell created earlier with given identifier "MyCellId". If such isn't found, create a new one:
cell = (UITableViewCell *)[aTableView dequeueReusableCellWithIdentifier:idCell];
if (cell == nil)This code requires a separate stand-alone XIB, which contains nothing but your UITableViewCell. But how do you define the reuseIdenfier? That property is read-only and created when table cell is created.
{
static NSString *nibcell = @"MyCell";
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:nibCell owner:self options:nil];
cell = (UITableViewCell *)[nib objectAtIndex:0];
}
reuseIdentifierOpen your XIB in Interface Builder, select UITableViewCell object, open "Table View Cell Attributes" (press command-1) and write your hardcoded magical string "MyCellId" into "Identifier" field. Use the same string in your code as reuseIdentifier.
A string used to identify a cell that is reusable. (read-only)
@property(nonatomic, readonly, copy) NSString *reuseIdentifier
Warning: you should NEVER access objects inside XIB (NIB) by magical index into array! Apple might change "something" in next Xcode release and thus break your code. You should use IBOutlets. You have been warned.
...yes, this is one of those sad "don't do as I do, but as I tell you to" cases...
Labels:
dequeueReusableCellWithIdentifier,
IBOutlet,
interface builder,
iphone,
loadNibNamed,
mainBundle,
NSBundle,
NSString,
objectAtIndex,
reuseIdentifier,
UITableViewCell,
XIB
Subscribe to:
Posts (Atom)