ios8

countdown in swift and spritekit

狂风中的少年 提交于 2019-12-08 13:29:14
问题 I'm trying to put a countDown on my application. I'm using a SKLabelNode. This is my code : class PlayScene: SKScene { var startCount = true var setTime = 0 var myTime = 0 var printTime = SKLabelNode(fontNamed: "arial") override func didMoveToView(view: SKView!) { self.backgroundColor = UIColor(hex: 0xD64541) self.printTime.text = NSString(format: "%i", self.myTime) self.addChild(self.printTime) } override func update(currentTime: NSTimeInterval) { if self.startCount == true { self.setTime =

Add Accessory to home always returns error(GenericError)

扶醉桌前 提交于 2019-12-08 12:46:44
问题 I am trying to add a accessory to Home(HMHome) and always error block is execute. I am getting GenericError which means An error occurred for which there is no more specific error code . I am not able to understand the reason of this error even documentation does not has the proper reason of it. And This is happening since last one day, earlier i was able to add the accessory by the same code. if (self.home != nil ){ self.home!.addAccessory(accessory, completionHandler: ({(error:NSError!) in

Application crashes with - dyld: Symbol not found: _OBJC_CLASS_$_UITraitCollection

走远了吗. 提交于 2019-12-08 12:10:55
问题 dyld: Symbol not found: _OBJC_CLASS_$_UITraitCollection The only place in the code I have reference to the UITraitCollection is: func loadImages(imageName: NSString) { var image: UIImage images = NSMutableArray(capacity: 7) for i in 0..7 { image = UIImage(named:"\(imageName)\(i).png", inBundle:nil, compatibleWithTraitCollection:nil) if (image != nil) { images.addObject(image) } } } 回答1: UITraitCollection is only part of the Foundation framework starting with ios8. What this error is saying is

Making certain words in an NSString bold and clickable like tags [closed]

孤街浪徒 提交于 2019-12-08 10:28:27
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I need to make certain words in a NSString be clickable and a different font style like a tag would. I have a code like so: NSString *str = @"This is my string and it is #cool and #fun. Please click on the tags."; So the above word #cool and #fun would become buttons to a uibutton

Unable to search in iTunes Store on iOS8

给你一囗甜甜゛ 提交于 2019-12-08 10:00:51
问题 I'm using this code to open iTunes Store app and search for specific music: NSString *iTunesLink = [NSString stringWithFormat:@"http://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?entity=album&media=all&page=1&restrict=true&startIndex=0&term=TERM_NAME"]; NSURL *url = [NSURL URLWithString:iTunesLink]; [[UIApplication sharedApplication] openURL:url]; Code works fine on iOS7, by changing TERM_NAME value I can search whatever I want. The issue on iOS8 is that somehow search term is

when updating label text a few images reset to their storyboard init size

南楼画角 提交于 2019-12-08 09:46:08
问题 I'm working on a game with score ( UILabel ) and a few moving UIImage s. From the day I installed XCode 6, every time I update the score all the images in the view go back to their first frame (the frame from the storyboard). I tried to update the score like this: label.text = @"4"; [label setText : @"4"]; but it still happens I think that if I will create this score label programmatically it might help, but I wanna know if some of you know about this bug and maybe you have some other

iOS8 Document directory path

最后都变了- 提交于 2019-12-08 09:29:07
问题 Issue in iOS8 document directory path detection: Am using following code to store downloaded attachments from my app into documents directory path. //-- Store data to documents folder NSString *resourceDocPath = [[NSString alloc] initWithString:[ [[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]]; NSString *filePath = [resourceDocPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",fileName]]; [self

PhotoKit iOS8 - Retrieve image using the “PHImageFileURLKey”

只愿长相守 提交于 2019-12-08 09:12:54
问题 Is there anyway I can use the Path returned from the "PHImageFileURLKey" to go into the photo library and retrieve the image? The path returned is in this format: "file:///var/mobile/Media/DCIM/102APPLE/IMG_2607.JPG" My plan is to store this path in the database and use it to fetch the image when I need to get it back. Any help is appreciated. Thank you! 回答1: I think your solution of retrieving Photo Kit asset from the URL is wrong. Here is what I would do (supposing you have access to

How do you limit only 1 decimal entry in a UITextField in Swift for iOS8?

自闭症网瘾萝莉.ら 提交于 2019-12-08 08:59:40
问题 I have searched all around for this but still cannot seem to get it to work. I have a simple iOS program with a UITextField that converts Farenheit to Celsius and Kelvin. I am trying to limit only 1 decimal entry in this UITextField. For example 98.9 is ok but 98..9 is not. This is the function in which I want to limit only 1 decimal. What I would like is if 1 decimal is entered then it will not allow another 1 to be entered but numbers can still be entered after the first decimal of course.

How to edit metadata of image in iOS8?

坚强是说给别人听的谎言 提交于 2019-12-08 08:56:20
问题 ALAssetsLibrary *lib = [[ALAssetsLibrary alloc] init]; [lib assetForURL:nil resultBlock:^(ALAsset *asset) { NSDictionary *metadata = rep.metadata; if (metadata) { NSDictionary *GPSDict=metadata[@"{GPS}"]; NSDictionary *TIFFDict=metadata[@"{TIFF}"]; if (GPSDict){ double longitude = [[GPSDict objectForKey:@"Longitude"] doubleValue]; double latitude = [[GPSDict objectForKey:@"Latitude"] doubleValue]; if ([[GPSDict objectForKey:@"LatitudeRef"] isEqualToString:@"S"]) { latitude = -latitude; } if (