ios9

Protocol Extension, Mutating Function

霸气de小男生 提交于 2019-11-28 13:16:51
I am using swift 2.0, I have a protocol and an extension on the protocol to create a default implementation of a method, the code is as fallows: protocol ColorImpressionableProtocol { var lightAccentColor: UIColor? {get set} var accentColor: UIColor? {get set} var darkAccentColor: UIColor? {get set} var specialTextColor: UIColor? {get set} mutating func adoptColorsFromImpresion(impresion: ColorImpressionableProtocol?) } extension ColorImpressionableProtocol { mutating func adoptColorsFromImpresion(impresion: ColorImpressionableProtocol?){ lightAccentColor = impresion?.lightAccentColor

Swift Compiler Error: Use of unresolved identifier 'name'

◇◆丶佛笑我妖孽 提交于 2019-11-28 13:16:42
I tried to include a class called 'name' and I got an error: Swift Compiler Error: Use of unresolved identifier 'name' The class exists and doesn't contain any compile errors. There could be a few possible issues. One of the classes has a Testing target and other one doesn't. You have to even include all of your classes in the testing target or none of them. If it's Objective C class, check that the class is in ObjectiveC bridging header file. If it's NSManagedObject subclass. Add @objc(className) before the class declaration. If it's part of a different framework, make sure that the class or

Remove duplicate structs in array based on struct property in Swift

妖精的绣舞 提交于 2019-11-28 12:54:18
I have made a simple struct and implemented the Equatable protocol : extension MyModelStruct: Equatable {} func ==(lhs: NModelMatch, rhs: NModelMatch) -> Bool { let areEqual = lhs.id == rhs.id return areEqual } public struct MyModelStruct { var id : String? var staticId : String? init(fromDictionary dictionary: NSDictionary){ id = dictionary["id"] as? String ... } Then in my project i get an array of [MyModelStruct], what i what to do is to remove all the MyModelStruct that have the same id let val1 = MyModelStruct(id:9, subId:1) let val2 = MyModelStruct(id:10, subId:1) let val3 =

preferredLanguages iOS 9

ぐ巨炮叔叔 提交于 2019-11-28 12:50:41
in order to localize my App, I use the following code: NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0]; if ([language isEqualToString:@"fr"]) { }else{ } But since iOS 9, I'have to replace "fr" by "fr-FR". The problem is that only works for France. How can I support all the other regions (Canada, Belgium,..) ? and the "general setting" for french ? Thanks If language is returning other values such a "fr-FR" and "fr-CA", then you should split language on the - character. This will work even you simply get "fr". NSString *firstLanguage = [[NSLocale preferredLanguages]

Handling App Transport Security (kCFStreamErrorDomainSSL, -9802)

家住魔仙堡 提交于 2019-11-28 12:14:44
You run this code: let URL = "https://www.nasa.gov/sites/default/files/wave_earth_mosaic_3.jpg" let imageData = NSData(contentsOfURL: NSURL(string: URL)!) UIImage(data: imageData!) and you get this: 2015-09-11 16:33:47.433 Cassini[21200:447896] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) Digging a bit deeper shows SHA1 signature is used. maximveksler$ openssl s_client -connect www.nasa.gov:443 < /dev/null 2>/dev/null | openssl x509 -text -in /dev/stdin | grep "Signature Algorithm" Signature Algorithm: sha1WithRSAEncryption Signature Algorithm:

Swipe to go back only works on edge of screen?

送分小仙女□ 提交于 2019-11-28 11:51:10
My swipe to go back feature works but only works on the edge of the screen. How can I have it work from anywhere on the screen? Apple says here : interactivePopGestureRecognizer The gesture recognizer responsible for popping the top view controller off the navigation stack. (read-only) @property(nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer The navigation controller installs this gesture recognizer on its view and uses it to pop the topmost view controller off the navigation stack. You can use this property to retrieve the gesture recognizer and tie it to the

HTTP load failed (kCFStreamErrorDomainSSL, -9806 ( IOS9)

核能气质少年 提交于 2019-11-28 11:34:35
问题 I am getting the NSURLSession/NSURLConnection HTTP load failed on iOS 9 while running app on Simulator. Here is how my info.plist file looks like <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSIncludesSubdomains</key> <true/> <!--Include to allow insecure HTTP requests--> <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/> <!--Include to specify minimum TLS version--> <key>NSTemporaryExceptionMinimumTLSVersion</key> <string>TLSv1.1</string

iPad Pro launch image and App icon

匆匆过客 提交于 2019-11-28 10:48:32
iPad Pro requires 167x167 App icon and 2732 x 2048 (landscape) launch image. But where should I put them? Xcode 7.1 Asset Catalogs don't provide any place to add iPad Pro specific icons or images. My launch image is size specific, so using storyboard for this isn't a good option. Stan Apple commented on this issue: "Latest beta (7.2b3) added 83.5@2x app icon slot to asset catalogs, and Developer relations reported in a radar comment that they no longer support launch images and will not be adding the iPad pro launch image size to asset catalogs." Taken from here . Slyv Use Launch Screen

error after updating the Xcode to 7.0

不打扰是莪最后的温柔 提交于 2019-11-28 10:36:22
问题 I'm developing an iOS application in Swift. When I updated the Xcode to 7.0, I'm getting error in swiftyJSON. static func fromObject(object: AnyObject) -> JSONValue? { switch object { case let value as NSString: return JSONValue.JSONString(value as String) case let value as NSNumber: return JSONValue.JSONNumber(value) case let value as NSNull: return JSONValue.JSONNull case let value as NSDictionary: var jsonObject: [String:JSONValue] = [:] for (k:AnyObject, v:AnyObject) in value {// **THIS

Safari web view opening when logging to FB through iOS 9

随声附和 提交于 2019-11-28 09:58:10
I've followed this guide to update my application to use Facebook SDK 4.6 for iOS 9 SDK. When I tap the login button now, a Safari view controller gets presented, whereas it should redirect to the Facebook app(App is installed on iPhone). Is any additional handling required ? It was working fine on previous versions(v4.3.0). From a product manager at Facebook in the "Facebook Developer Community" group. And my Reply, still waiting for a response: So it sounds like with SDK 4.6 they are forcing every login to use the Safari View Controller. EDIT ---- And their response: From FacebookSDK version