Codesign error: Provisioning profile cannot be found after deleting expired profile

Sometimes your Xcode project file gets messed up, especially if you have an old project and first created it with an older version of Xcode/iPhone SDK. What you need to do is open up the project file in a text editor, search for the ‘long string’ from your error and manually erase that line. In … Read more

How to determine the current iPhone/device model?

I made this “pure Swift” extension on UIDevice. If you are looking for a more elegant solution you can use my ยต-framework DeviceKit published on GitHub (also available via CocoaPods, Carthage and Swift Package Manager). Here’s the code: import UIKit public extension UIDevice { static let modelName: String = { var systemInfo = utsname() uname(&systemInfo) … Read more

How can I set the title of a UIButton as left-aligned?

Set the contentHorizontalAlignment: // Swift emailBtn.contentHorizontalAlignment = .left; // Objective-C emailBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; You might also want to adjust the content left inset otherwise the text will touch the left border: // Swift 3 and up: emailBtn.contentEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0); // Objective-C emailBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);

How to hide UINavigationBar 1px bottom line

For iOS 13: Use the .shadowColor property If this property is nil or contains the clear color, the bar displays no shadow For instance: let navigationBar = navigationController?.navigationBar let navigationBarAppearance = UINavigationBarAppearance() navigationBarAppearance.shadowColor = .clear navigationBar?.scrollEdgeAppearance = navigationBarAppearance For iOS 12 and below: To do this, you should set a custom shadow image. But for … Read more

How do I get the App version and build number using Swift?

EDIT Updated for Swift 4.2 let appVersion = Bundle.main.infoDictionary?[“CFBundleShortVersionString”] as? String EDIT As pointed out by @azdev on the new version of Xcode you will get a compile error for trying my previous solution, to solve this just edit it as suggested to unwrap the bundle dictionary using a ! let nsObject: AnyObject? = Bundle.main.infoDictionary![“CFBundleShortVersionString”] … Read more

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