ios8

Can In App Purchases be tested in the IOS 8 (Xcode 6) Simulator?

試著忘記壹切 提交于 2019-12-20 11:37:07
问题 I keep finding conflicting information about whether In App Purchases can actually be tested on a simulator using Xcode 6. Some answers say ' yes ', others seem to indicate there are a bug in beta versions of Xcode 6 and others flat out ' no '. I have an app where IAP works great on the device, but in the simulator, trying to refresh the receipt fails with a very unhelpful message: Error Domain=SKErrorDomain Code=0 "The operation couldn’t be completed. (SKErrorDomain error 0.)" . My app was

iOS 8 push notification action buttons - code in handleActionWithIdentifier does not always run when app is in background

心不动则不痛 提交于 2019-12-20 11:32:04
问题 I am adding two action buttons to my push notifications on iOS 8: an Accept button and a Deny button. Neither button will open the app, but different server requests will be made depending on which button is pressed. Here's my setup: + (void)requestForPushNotificationToken { UIApplication *application = [UIApplication sharedApplication]; // if ios 8 or greater if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { UIMutableUserNotificationAction *acceptAction = [

Getting selected value of a UIPickerViewControl in Swift

北城以北 提交于 2019-12-20 11:23:48
问题 How can I get the selected value of a UIPickerViewControl in Swift? I tried something like this: labelTest.text = Spinner1.selectedRowInComponent(0).description But this only returns the selected index. I need the value. Anyone who knows how to do this? 回答1: you will have to set the picker view delegate to self and override this function func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { // use the row to get the selected row from the picker view //

Getting selected value of a UIPickerViewControl in Swift

社会主义新天地 提交于 2019-12-20 11:23:05
问题 How can I get the selected value of a UIPickerViewControl in Swift? I tried something like this: labelTest.text = Spinner1.selectedRowInComponent(0).description But this only returns the selected index. I need the value. Anyone who knows how to do this? 回答1: you will have to set the picker view delegate to self and override this function func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { // use the row to get the selected row from the picker view //

UIPopoverController, Xcode 6, IOS 8 using Swift

孤者浪人 提交于 2019-12-20 10:58:31
问题 I'm having some trouble getting a UIPopover to appear using swift. The code that is commented out works fine in Objective-C, but doesn't work using Swift. When I tap the + in my view controller I do get the "click" in my debugger, however no popover appears. class PlayerInformationTableViewController: UITableViewController, NSFetchedResultsControllerDelegate, UIPopoverControllerDelegate { @IBOutlet weak var addBarButtonItem: UIBarButtonItem! var playerInformationViewController =

Full swipe UITableViewCell to delete UITableView iOS 8

左心房为你撑大大i 提交于 2019-12-20 10:28:03
问题 I'd like to mimic the swipe to delete function of a UITableViewCell just like the mail app in iOS 8. I'm not referring to swipe to reveal a delete button. I'm referring to when you swipe, it discoloses 3 actions, but if you keep swiping to the left, the email is deleted. In iOS 8, UITableView has a new method where you can provide the data to display any number of buttons: #ifdef __IPHONE_8_0 - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath

MFMailComposeViewController in Swift

青春壹個敷衍的年華 提交于 2019-12-20 10:22:28
问题 This is sample code: import UIKit import MessageUI class ViewController: UIViewController, MFMailComposeViewControllerDelegate { @IBAction func showEmail(sender : AnyObject) { var emailTitle = "Test Email" var messageBody = "This is a test email body" var toRecipents = ["a.nakhimov@gmail.com"] var mc: MFMailComposeViewController = MFMailComposeViewController() mc.mailComposeDelegate = self mc.setSubject(emailTitle) mc.setMessageBody(messageBody, isHTML: false) mc.setToRecipients(toRecipents)

How to retrieve address book contacts with Swift?

不想你离开。 提交于 2019-12-20 09:57:58
问题 I don't understand why my code doesn't compile with Swift. I am trying to convert this Objective-C code: CFErrorRef error = NULL; ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, &error); if (addressBook != nil) { NSLog(@"Succesful."); NSArray *allContacts = (__bridge_transfer NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook); } This is my current rendition in Swift: var error:CFErrorRef var addressBook = ABAddressBookCreateWithOptions(nil, nil); if (addressBook !=

iOS 8 Swift Xcode 6 - Set top nav bar bg color and height

怎甘沉沦 提交于 2019-12-20 09:55:25
问题 I have looked everywhere and tested all the code snippets posted on Stack, but nothing works for me as I need it to work. I simply want to set: Nav bar height Nav bar bg color in RGB Nav bar centered logo I'm working with iOS8, Xcode 6 and Swift. Many thanks for a clear answer! This is my code in ViewController.swift // Set nav bar height navigationController?.navigationBar.frame.origin.y = -10 // Set nav bar bg color var navBarColor = UIColor(red: 4 / 255, green: 47 / 255, blue: 66 / 255,

presentViewController in AppDelegate with delay in iOS8

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 09:49:01
问题 So I had a full working solution in iOS7 that displays a LoginViewController via presentViewController in the AppDelegate's didFinishLaunching. Basically I am doing something like this: UIViewController *backgroundViewController = ... self.window.rootViewController = backgroundViewController; [self.window makeKeyAndVisible]; [self.window.rootViewController presentViewController:loginViewController animated:NO ...] In iOS8 I see a jump. First I see the backgroundViewController then after about