ios8

NSUserDefaults standardUserDefaults not working with extension

坚强是说给别人听的谎言 提交于 2020-01-03 12:59:19
问题 I added App Groups to my app ID in the developer portal and am using that App ID in my provisioning profile. My Product Identifier in Xcode is set to that app ID. In my app delegate I call this from didFinishLaunchingWithOptions NSUserDefaults.standardUserDefaults().setObject("hey", forKey: "TEST") NSUserDefaults.standardUserDefaults().synchronize() In my keyboard app extension I call this: if let test = NSUserDefaults.standardUserDefaults().objectForKey("TEST") as? String { println(test) }

UITableview Cell exception - 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES

依然范特西╮ 提交于 2020-01-03 10:58:10
问题 I am using the UITableView. CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierLink]; This is the line I am getting the error. It is working in IOS 7. But when I run the application in IOS 8 I am getting the error ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Must translate autoresizing mask into constraints to have _setHostsLayoutEngine:YES. EDIT Full code - (UITableViewCell *)tableView:(UITableView *)tableView

in iOS 8 UITableView heightForHeaderInSection is not optional

会有一股神秘感。 提交于 2020-01-03 10:41:13
问题 I've just noticed that in iOS 8, a tableview which is defined programmatically must define heightForHeaderInSection in addition of viewForHeaderInSection , otherwise the default height will be 0 and the sections headers won't appear. While in iOS 7 and under the sections header where appearing even if heightForHeaderInSection is not defined. I wonder if somebody noticed the same behavior because it's not mentioned in the iOS 8 UITableView class reference 回答1: I can duplicate this issue, and

dyld`gdb_image_notifier exception when i run my application in device

偶尔善良 提交于 2020-01-03 09:20:09
问题 When try to load my application on device sometimes i got following exception dyld`gdb_image_notifier:0x2beca0cc: bx lr but after stop and run again everything works fine, can anyone tell me why this occurs 回答1: Basically it seems there is a breakpoint in the debugger. Thought it's not a solution, in order to run the app on the device, just click "Debug" and then "Continue" (or ^⌘Y). That should help pass the breakpoint and carry on running the app. "Debug" -> "Deactivate Breakpoints" can

Iphone flashlight not working while app is in background

左心房为你撑大大i 提交于 2020-01-03 08:44:32
问题 Hi i am using a location based app and wants to use iphone camera flashlight while in background.Unfortunately flashlight is working only in foreground ,it automatically turns off the flash in background even though the code is executing . The code i used is working only in foreground #import <AVFoundation/AVFoundation.h> //flashcode Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); if (captureDeviceClass != nil) { AVCaptureDevice *device = [AVCaptureDevice

How to make text appear in centre of the image?

五迷三道 提交于 2020-01-03 05:50:10
问题 I want to add a text on an image, and I'm able to do it as shown in below code. func textToImage(drawText: NSString, inImage: UIImage, atPoint:CGPoint)->UIImage{ // Setup the font specific variables var textColor: UIColor = UIColor.redColor() var textFont: UIFont = UIFont(name: "AmericanTypewriter", size: 75)! let textStyle = NSTextEffectLetterpressStyle //Setup the image context using the passed image. UIGraphicsBeginImageContext(inImage.size) let textFontAttributes = [ NSFontAttributeName:

Remove mask from deselected tabs UITabBarItem Swift

。_饼干妹妹 提交于 2020-01-03 05:22:39
问题 I am trying to implement an UITabBarController with 2 UITabBarItems . I added in storyboard the TabBarController. I almost did it, but still I am blocked with 2 important issues: 1) Here is how tab bar should look: Please ignore orange button, that is not a tabItem. So I put 2 tabItems , and I want to keep white images for both tabs even if one of them is selected. I checked a lot of times with tintColor , barTintColor and no success. Also I tried to set tabBarItem in ViewController: override

How to get Heartrate data from Apple's Healthkit?

Deadly 提交于 2020-01-03 04:40:09
问题 I am trying to read Heartrate data from Healthkit. I am not able to read that data. I have gone throught this link. Please help me guys..Thank you. 回答1: I managed to read the heart rates from HelathKit using HKSampleQuery. I start reading it from the beginning of the day till 'now'. I also used this link Here is my function and I call it by pressing a button: - (void)readHeartRateWithCompletion:(void (^)(NSArray *results, NSError *error))completion { //get the heart rates NSDate *now =

AVFoundation play consecutive video fragments

你说的曾经没有我的故事 提交于 2020-01-03 03:12:40
问题 I am working on an iOS app that involves fetching video fragments that are part of a stream from a web server and playing them consecutively inside the app. After some research, I decided to use an AVQueuePlayer. Every time I fetch an MP4 file from the server and store it in an NSData object, I create an AVPlayerItem and append it to the queue. Also, I listen to the AVPlayerItemDidPlayToEndTimeNotification notification where I advance to next item. The issue I am facing is an annoying small

SpriteKit - Mouse Snaps to Center On Sprite Drag

女生的网名这么多〃 提交于 2020-01-03 01:42:08
问题 I'm trying to create an iOS game and I have it so that when the item is touched and moved it is dragged. When it is dragged the mouse is snapped to the center of the sprite. How could I make it so that this wouldn't happen? Here is an example of what is happening. Here are the functions dealing with touch input override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) { var papers = 0 for touch in (touches as! Set<UITouch>) { let location = touch.locationInNode(self) let