ios8

The connection to service named com.apple.nsurlstorage-cache was invalidated

余生长醉 提交于 2019-12-09 03:30:32
问题 I'm creating a custom keyboard for iOS8, and I'm having a tough time figuring out some issues with NSURLConnection. I'm using the sendAsynchronousRequest: method like this: [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { NSLog(@"recieved asynchronous response"); if (!connectionError) { [self connection:nil didReceiveData:data]; [self connectionDidFinishLoading:nil]; }

Save a tuple in NSUserDefaults

一曲冷凌霜 提交于 2019-12-09 03:11:49
问题 I'm using a tuple to store something like this. var accessLavels: (hasInventoryAccess: Bool, hasPayrolAccess: Bool) accessLavels = (hasInventoryAccess: true, hasPayrolAccess: false) Now I want to save it in NSUserDefaults . NSUserDefaults.standardUserDefaults().setValue(accessLavels, forKey: "AccessLevelKey") NSUserDefaults.standardUserDefaults().synchronize() But I get the following error. Type '(hasInventoryAccess: Bool, hasPayrolAccess: Bool)' does not conform to protocol 'AnyObject' How

UITableViewCell throwing exception

廉价感情. 提交于 2019-12-09 02:49:44
问题 I am updating a project to iOS 8 and am running into this issue with one of my UITableViewCell implementations. Currently on Simulator and not a device and it is set to "iPhone 6". *** Assertion failure in -[UITableViewCell _setHostsLayoutEngine:], /SourceCache/UIKit_Sim/UIKit-3318/NSLayoutConstraint_UIKitAdditions.m:2754 2014-09-15 10:43:52.890 BasketballStatTracker[10662:304085] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate

iOS 8.0 - “failed to scene-update in time” crash

假如想象 提交于 2019-12-09 02:28:10
问题 I've encountered the following crash while running on iOS 8.0. This is the first time I'm seeing this so any observation will be helpful: Incident Identifier: C39AF13A-D02B-40B1-8FC3-CFED8226D6FA CrashReporter Key: dace0b0fe53a1661c59ffa598b3a139a6177d713 Hardware Model: iPhone7,2 Process: Vieu [435] Path: /private/var/mobile/Containers/Bundle/Application/36CE6BFB-F90E-452B-8A4F-2B352F95DE48/Vieu.app/Vieu Identifier: com.vieu.mobile Version: 140929 (1.0) Code Type: ARM-64 (Native) Parent

[__NSCFTimer copyWithZone:]: unrecognized selector sent to instance

天大地大妈咪最大 提交于 2019-12-09 01:54:37
问题 var searchDelayer:NSTimer? func searchBar(searchBar: UISearchBar!, textDidChange searchText: String!) { searchDelayer?.invalidate() searchDelayer = nil searchDelayer = NSTimer.scheduledTimerWithTimeInterval(1.5, target: self, selector: Selector("doDelayedSearch:"), userInfo: searchText, repeats: false) } func doDelayedSearch(text:String){ ... } Why this code crashes with error message: [__NSCFTimer copyWithZone:]: unrecognized selector sent to instance Updated: Terminating app due to uncaught

Swift + macro parameters

孤街浪徒 提交于 2019-12-09 01:02:20
问题 I read all Q&A related to Macros in Swift , And i did figure out that everything in Swift now global, Am i right? And my actual question is that if i have a macro in which i need parameters to be pass then how can i pass it in Swift language? e.g. Objective-C Macro #define COLOR_CODE(red, green, blue, alpha) [UIColor colorWithRed: red/255.0 green: green/255.0 blue: blue/255.0 alpha: alpha] What is the Swift syntax for above macro? 回答1: As 0O0O0O0 mentioned, macros in the sense of "The

Hide status bar while scrolling

为君一笑 提交于 2019-12-08 23:10:10
问题 iOS 8 adds a super new cool feature: hiding the navigation bar when user is scrolling. This with a single line in viewDidload : navigationController?.hidesBarsOnSwipe = true Cool, isn't it? But now I have a little problem: when the navigation bar is hidden, the status bar is still here and overlaps content, which is ugly. What should I do to make it hidden when the navigation bar is hidden? 回答1: Override the following methods on UIViewController: extension MyViewController { override func

PhoneGap using way more memory in iOS8 than iOS7

爷,独闯天下 提交于 2019-12-08 23:08:05
问题 I have a PhoneGap app. An HTML5 Canvas game. It appears to use significantly more memory in iOS 8 (including 8.0.2) vs iOS 7. In addition to using more memory, the JS Garbage Collector does not seem to ever free up the memory it is holding. It is collecting "freed" memory correctly, but never releasing it back for iOS to use. Here is the memory usage using Instruments Allocations under iOS 7 with an iPhone 5S. As you can see it goes up and down as I load and unload a level. Also the memory

Getting the location of a PHAsset in Swift

左心房为你撑大大i 提交于 2019-12-08 22:02:52
问题 For some reason the location property on a PHAsset is only exposed in Objective-c and not in Swift. Documentation: PHAsset.location To work around it, I figured I could create a Objective-C class whose sole purpose is to extract the location and import it into Swift. LocationGetter.h @interface LocationGetter : NSObject + (CLLocation *)locationForAsset:(PHAsset *) asset; @end LocationGetter.m @implementation LocationGetter + (CLLocation *)locationForAsset:(PHAsset *) asset { return [asset

Localizing the user on iOS 8

南笙酒味 提交于 2019-12-08 20:13:58
问题 Hullo, I am starting to port my apps to iOS 8 and I soon bounced into a problem with CLLocationManager. Basically the app no longer centers the map on the user's location and instead proposed error: Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first. Executing [CLLocationManager requestAlwaysAuthorization] does nothing and even inserting the