Audio format for iOS and Android

Android and iOS use the same server to storage records. All records are saved without any extension. When Android downloads a record from the server, my app adds an “.aac” extension. When using iOS, it adds an “.m4a” extension. The same record plays good on both mobile platforms. Record on iOS: NSDictionary recorderSettings = [[NSDictionary … Read more

Dynamically getting height of UILabel according to Text return different Value for iOS 7.0 and iOS 6.1

You have to dynamically set the frame, like below: Tested on iOS 6 to iOS 12.2 Swift: let constrainedSize = CGSize(width: self.titleLable.frame.size.width, height:9999) let attributesDictionary = [NSAttributedString.Key.font: UIFont.init(name: “HelveticaNeue”, size: 11.0)] let string = NSAttributedString.init(string: “textToShow”, attributes: attributesDictionary as [NSAttributedString.Key : Any]) var requiredHeight = string.boundingRect(with: constrainedSize, options: .usesLineFragmentOrigin, context: nil) if (requiredHeight.size.width > self.titleLable.frame.size.width) … Read more

Want to create a cool static UI but : “Static table views are only valid…”

I’ve also ran into an issue when changing an existing custom view controller, making it extends UITableViewController. XCode isn’t smart enough and won’t realize it already fits its requirements. You can solve this problem by editing storyboard source code and changing <viewController … to <tableViewController…. Original source: https://plus.google.com/108665969482300807329/posts/J4mCASMA3pZ

Wait For Asynchronous Operation To Complete in Swift

you have to pass your async function the handler to call later on: func application(application: UIApplication!, performFetchWithCompletionHandler completionHandler: ((UIBackgroundFetchResult) -> Void)!) { loadShows(completionHandler) } func loadShows(completionHandler: ((UIBackgroundFetchResult) -> Void)!) { //…. //DO IT //…. completionHandler(UIBackgroundFetchResult.NewData) println(“Background Fetch Complete”) } OR (cleaner way IMHO) add an intermediate completionHandler func application(application: UIApplication!, performFetchWithCompletionHandler completionHandler: ((UIBackgroundFetchResult) -> Void)!) … Read more

wireless iphone app distribution – problem with itms-services protocol

The answer is actually very simple: The URL needs to be “double-escaped”, i.e. itms-services://?action=download-manifest&url=https://example.com/My%2520App.plist This is because the value gets unescaped to https://example.com/My%20App.plist before being treated as another URL. This gets unescaped by the server at example.com to a space. The parser does not treat + specially: …&url=https://…/test/a+b results in “GET /test/a+b HTTP/1.1” appearing in … Read more

Interface orientation in iOS 6.0

Deprecated method in iOS 5: // Override to allow orientations other than the default portrait orientation. – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); } Replacement in iOS 6 and equivalent of this deprecated iOS 5 method above: – (BOOL) shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscapeRight; } … Read more