what kind of certificate do I need to test apns using ad-hoc distribution?

You need to create a Distribution Certificate. The Distribution Certificate are used for creating Distribution Provisioning Profiles. Which will allow you to do the following: Create an Ad-Hoc version of your app (this is used if you want to distribute to beta-users, testers, etc (this is what you want)) Create an App Store version of … Read more

How to restrict number of characters that can be entered in HTML5 number input field on iPhone

Example JS function limit(element) { var max_chars = 2; if(element.value.length > max_chars) { element.value = element.value.substr(0, max_chars); } } HTML <input type=”number” onkeydown=”limit(this);” onkeyup=”limit(this);”> If you are using jQuery you can tidy up the JavaScript a little: JS var max_chars = 2; $(‘#input’).keydown( function(e){ if ($(this).val().length >= max_chars) { $(this).val($(this).val().substr(0, max_chars)); } }); $(‘#input’).keyup( function(e){ … Read more

iPhone – UIWindow rotating depending on current orientation?

You need to roll your own for UIWindow. Listen for UIApplicationDidChangeStatusBarFrameNotification notifications, and then set the the transform when the status bar changes. You can read the current orientation from -[UIApplication statusBarOrientation], and calculate the transform like this: #define DegreesToRadians(degrees) (degrees * M_PI / 180) – (CGAffineTransform)transformForOrientation:(UIInterfaceOrientation)orientation { switch (orientation) { case UIInterfaceOrientationLandscapeLeft: return CGAffineTransformMakeRotation(-DegreesToRadians(90)); … Read more

NSGenericException’, reason: ‘Unable to install constraint on view

You need to install the constraint on the “higher” of the two views. A good, general way to do this is like this: NSLayoutConstraint* constraint = …; NSView* firstView = constraint.firstItem; NSView* secondView = constraint.secondItem; [[firstView ancestorSharedWithView: secondView] addConstraint: constraint]; Just a word of caution: It’s good to remember here that constraint attributes are evaluated … Read more

Write only property in Objective-C

Another valid approach is to declare the normal property and make the getter unavailable @interface MyClass @property NSString * var; – (NSString *)var UNAVAILABLE_ATTRIBUTE; @end This will raise a compile-time error in case someone tries to access the getter. The main advantage of this approach is that you actually have a real propertyTM and not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)