ios9

ios9 字符串与UTF-8 互相转换

穿精又带淫゛_ 提交于 2020-01-22 20:50:23
在数据网路请求或其他情况下,需要将字符串转换成UTF-8编码 ios9后对其方法进行了修改 NSString *str = @"北京"; 把这个转成UTF8以前我们使用的是 NSString *str3 = [str stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; 但是在ios9这个方法废弃了 用如下方法转 NSString *str1 = [str stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; 那如果想转成“北京”这个字符串怎么办呢 ,不用担心有方法的 还是说以前我们用的方法是 NSString *str3 = [str1stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; ios9同样废弃了这个方法 现在使用 NSString *str2 = [str1 stringByRemovingPercentEncoding]; iOS9现在使用的转码方法: NSString *str = @"http://www.test.com/你好.jpg"; NSString

How to add a HTTPS proxy to NSURLSession in SWIFT 3

余生长醉 提交于 2020-01-22 16:19:52
问题 I have used the following code for connecting to the proxy server and works great for only HTTP requests but not for HTTPS. In iOS 9.0, kCFStreamPropertyHTTPSProxyHost and kCFStreamPropertyHTTPSProxyPort are depreciated. let myPortInt = 12345; let myProxyUrlString = "myProxyURL"; let sessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration(); sessionConfiguration.connectionProxyDictionary = [ kCFNetworkProxiesHTTPEnable: true, kCFNetworkProxiesHTTPPort: myPortInt,

iOS9 Untrusted Enterprise Developer with no option to trust

删除回忆录丶 提交于 2020-01-18 04:46:11
问题 This is not a duplicate of Untrusted App Developer. Since iOS9 there is no option to trust an enterprise build. Has anyone found a workaround? 回答1: In iOS 9.1 and lower, go to Settings - General - Profiles - tap on your Profile - tap on Trust button. In iOS 9.2+ & iOS 11+ go to: Settings - General - Profiles & Device Management - tap on your Profile - tap on Trust button. In iOS 10+, go to: Settings - General - Device Management - tap on your Profile - tap on Trust button. 回答2: Do it like

Why In iOS 9 and Xcode 7 not show full view height and width in iPhone 6 and above?

自作多情 提交于 2020-01-15 08:55:28
问题 I am using iOS 9 and Xcode 7 ....and I make new app without storyboard and use auto layout and use size classes.....basically I am using xib with resizing feature and use code to check device . When I was using xcode 6.4 and iOS 8 then my code work for each device . But when I use Xcode 7 and iOS 9 then screen not show full on device this is only for iPhone 6 and above. I attached image here... See In image black part appear on each screen for iPhone 6 and above.....I add all launch images on

iOS9 FileManager File permissions change

社会主义新天地 提交于 2020-01-15 01:48:17
问题 After switching my application to iOS9 I started to get errors that the files I was writing were not readable. Here is how I create the files let fileManager = NSFileManager.defaultManager() let directory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] let path = "\(directory)/file.txt" let attributes: [String:AnyObject] = [NSFilePosixPermissions: NSNumber(short: 666)] let success = fileManager.createFileAtPath(path, contents: nil, attributes: attributes)

NSURLSession returns different response than browser would, why?

妖精的绣舞 提交于 2020-01-14 14:33:48
问题 Any idea why NSURLSession returns this response: The authorization type you provided is not supported. Only Basic and OAuth are supported let username = "8r6nibK8Pe28WFhjTX1gGb1Rhhhc7xM02v7XKRPedL4" let password = "8r6nibK8Pe28WFhjTX1gGb1Rhhhc7xM02v7XKRPedL4" let loginString = NSString(format: "%@:%@", username, password) let loginData: NSData = loginString.dataUsingEncoding(NSUTF8StringEncoding)! let base64LoginString = loginData.base64EncodedStringWithOptions(.Encoding64CharacterLineLength)

Facebook Login SDK in IOS 9

纵然是瞬间 提交于 2020-01-13 04:28:48
问题 I am using the facebook login SDK. It is working perfectly in IOS 7, 8 and 9. But if phone have the facebook app login verification is open the app in iOS 7 AND 8. BUT IOS 9 not open the facebook app. It is open the browser (Web page) and doing the verification. What is the reason? Anybody have any idea? Edited FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; [FBSDKProfile enableUpdatesOnAccessTokenChange:YES]; [login logInWithReadPermissions:@[@"public_profile", @"email"]

On demand resources in iOS 9 - how to find out exact location of downloaded resources?

被刻印的时光 ゝ 提交于 2020-01-12 08:05:51
问题 I'm trying to use ODR in my game which doesn't use xcassets. So, I've got a texture with a tag (e.g. "tutorial"), made it ODR in project settings and used the code below the get it downloaded: NSBundleResourceRequest *resourceRequest = [[NSBundleResourceRequest alloc] initWithTags:tags]; [resourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:^(BOOL resourcesAvailable) { if (resourcesAvailable) { // Upload the texture } else { [resourceRequest

Import XCTest into a dynamic framework

∥☆過路亽.° 提交于 2020-01-11 17:40:16
问题 I have a project where I have created a dynamic framework. Inside the framework itself, not the framework's tests, I have the following file: import Foundation import XCTest public func assertThrowsException(function: () throws -> Void) { XCTAssertTrue(doesItThrowException(function)) } public func assertDoesNotThrowsException(function: () throws -> Void) { XCTAssertFalse(doesItThrowException(function)) } private func doesItThrowException(function: () throws -> Void) -> Bool { do { let _ = try

How to use AVCaptureSession with Slide Over and Split View in iOS 9?

早过忘川 提交于 2020-01-11 15:49:06
问题 My team is developing a set of SDKs for barcode scanning, ID scanning and OCR. We use device's camera, specifically, AVCaptureSession , to obtain video frames on which we perform our processing. We're exploring new iOS 9 multitasking features Slide Over and Split View. Apple suggests opting out of these features for camera-centric apps, where using the entire screen for preview and capturing a moment quickly is a primary feature (reference). This is the approach the use in their sample app