iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

UIScrollView and Constraints

I’m trying to place a UIImageView at the top of a UIScrollView and when I constrain the UIScrollView to the sides of the View Controller and constrain the UIImageView to the top and make the width of the UIImageView equal to the UIScrollView it makes the UIImageView way wider than the UIScrollView, and much taller […]

Application crashed while importing songs from Ipod library in Iphone for iOs 5.0

Hello i am using below framworks, #import <MediaPlayer/MediaPlayer.h> #import <AudioToolbox/AudioToolbox.h> #import <AVFoundation/AVFoundation.h> In one of button event i have implemented below code to open Library. MPMediaPickerController *mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic]; mediaPicker.delegate = self; mediaPicker.allowsPickingMultipleItems = YES; // this is the default [self presentModalViewController:mediaPicker animated:YES]; [mediaPicker release]; And in delegate methods of MPMediaPickerController implemented code […]

Invalid Swift Support / invalid implementation of swift

I’d like to upload an app written in swift. Application loader delivers the app successfully, but after a few minutes I get a reply by apple telling: Invalid Swift Support – The bundle contains an invalid implementation of Swift. The app may have been built or signed with non-compliant or pre-release tools. Visit developer.apple.com for […]

NSLocalizedString with swift variable

I’m trying to localize my app using NSLocalizedString. When i import the XLIFF file, most works like a charm but something do not and some string is not localized. I have noticed that the problem is from NSLocalizedString containing something variable inside like: NSLocalizedString(” – \(count) Notifica”, comment: “sottotitolo prescrizione per le notifiche al singolare”) […]

How to dismiss ViewController in Swift?

I am trying to dismiss a ViewController in swift by calling dismissViewController in an IBAction @IBAction func cancel(sender: AnyObject) { self.dismissViewControllerAnimated(false, completion: nil) println(“cancel”) } @IBAction func done(sender: AnyObject) { self.dismissViewControllerAnimated(false, completion: nil) println(“done”) } I could see the println message in console output but ViewController never gets dismissed. What could be the problem?

Detect carrier connection type (3G / EDGE / GPRS)

How can i get the type of connection of a carrier network? I’m able to get if connection is WIFI or WWAN using Reachability class I’m able to get network flags Reachability Flag Status: WR t—— localWiFiStatusForFlags I’m able to get WIFI SSID using CaptiveNetwork Supported interfaces: ( en0 ) en0 => { BSSID = […]

Swift 2.0 calendar components error

Hi I get this error in swift 2.0 Cannot invoke ‘components’ with an argument list of type ‘(NSCalendarUnit, fromDate: NSDate?, toDate: NSDate?, options: nil)’ var hoy = dataFormatter.stringFromDate(NSDate()) var despues = dataFormatter.stringFromDate(fecha) var calHoy = dataFormatter.dateFromString(hoy) var calcDesp = dataFormatter.dateFromString(despues) let cal = NSCalendar.currentCalendar() let unit:NSCalendarUnit = .Day let components = cal.components(unit, fromDate: calcDesp, toDate: […]

iOS 6 Facebook posting procedure ends up with “remote_app_id does not match stored id”

This is my third question about posting on Facebook. Although this may be a duplicate of Mac OS X Facebook login failed – no stored remote_app_id for app but I decided to post separate question because we have iOS here but not MAC OS. A few days ago I posted a question iOS 6 Facebook […]

Detect if app is being built for device or simulator in Swift

In Objective-C we can know if an app is being built for device or simulator using macros: #if TARGET_IPHONE_SIMULATOR // Simulator #else // Device #endif These are compile time macros and not available at runtime. How can I achieve the same in Swift? I searched stack overflow, had a look into the docs and cannot […]

RootViewController animation transition, initial orientation is wrong

So I followed this thread: RootViewController Switch Transition Animation to transit the window.rootViewController from A to B to C. Code looks like this: [UIView transitionWithView:self.window duration:0.5 options: UIViewAnimationOptionTransitionFlipFromLeft animations:^{ self.window.rootViewController = newViewController; } completion:nil]; The problem is my app shall only support landscape, but during the rootViewController transition, the new view controller appears in portrait […]