ios8

Swift UIApplication.setStatusBarStyle Doesn't work

走远了吗. 提交于 2019-12-10 17:22:14
问题 Here's my implementation in a subclass of UIViewController : override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: false) } I tried putting it in AppDelegate initialisation code (using the passed in UIApplication instance), however the status bar is still black.. Is this a bug with iOS 8 or am I doing it wrong? Note: I may be breaking someone's law's here by discussing ios 8..

In-App Purchase fails on iOS 8, saying user details are incorrect

别来无恙 提交于 2019-12-10 17:09:00
问题 We have an app with In-App Purchases, which is working fine on iOS 7. But on iOS 8, when a user tries to purchase anything in the app, In-App Purchase fails with the error “The Apple ID you entered couldn't be found or your password was incorrect. Please try again”, even though the ID / password are (we believe) correct. This happened on any iOS 8 device we tested on (with six different models of iPhones and iPod Touches), and happens on 8.0, 8.0.1, and 8.0.2. We tried this with many

CKDiscoverAllContactsOperation not fetching contacts

泄露秘密 提交于 2019-12-10 17:08:09
问题 I am using CKDiscoverAllContactsOperation but its not working fine for me. -(void)queryForAllUsers: (void (^)(NSArray *records))completionHandler { CKDiscoverAllContactsOperation *op = [[CKDiscoverAllContactsOperation alloc] init]; [op setUsesBackgroundSession:YES]; op.queuePriority = NSOperationQueuePriorityNormal; [op setDiscoverAllContactsCompletionBlock:^(NSArray *userInfos, NSError *error) { if (error) { NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error); //abort();

Set notifications from Today Extension Widget

匆匆过客 提交于 2019-12-10 17:07:43
问题 I am creating a simple timer app which will have a lot of focus on the today extension widget features. Users can start the timer from here by tapping. The only problem is that I need to set a local notification from the widget. I have tried to use [[UIApplicaton sharedApplication] scheduleLocalNotification] but Xcode throws an error saying that shared application is unavailable in app extension. Is there any solution for setting a local notification from Today extension? Thanks in advance.

Google Maps API for iOS myLocationEnabled not working

风格不统一 提交于 2019-12-10 16:56:31
问题 I am trying to use the Google Maps API but am having trouble getting the user's location. The observed value never seems to change since observeValueForKeyPath is never called. Note: I am running Xcode6-Beta 5 and iOS8 beta (code is in Swift) override func viewDidLoad() { super.viewDidLoad() var camera:GMSCameraPosition? = nil mapView_ = GMSMapView.mapWithFrame(CGRectZero, camera:camera); mapView_!.addObserver(self, forKeyPath: "myLocation", options: NSKeyValueObservingOptions.fromRaw(0x01)!,

Check battery level in background?

Deadly 提交于 2019-12-10 15:56:04
问题 Is it possible to check battery level in swift while our application is in background? Currently I am working on one iOS application in which user will be alerted with system notification when battery reached to 30%. I tried and I received notification randomly, sometimes 4%, sometimes 10%, mover than ever 30%. func applicationDidEnterBackground(application: UIApplication) { if(UIDevice.currentDevice().batteryLevel <= 0.30 && UIDevice.currentDevice().batteryState != UIDeviceBatteryState

Table View Cells “jump” when going back from View Controller to Table View Controller

你离开我真会死。 提交于 2019-12-10 15:53:32
问题 I have a TableViewController , and clicking on a custom cell takes you to a related WebViewController . The problem I'm having is that when I tap "Back" in the WebViewController the Table View Cells in TableViewController "jump". Once the Table View starts scrolling they all jump back into the right heights. So I'm assuming it has something to do with heights on the TableViewController custom cells, but I'm not totally sure. TableViewController.m Tried: - (CGFloat) tableView:(UITableView *

Is it possible to make an Array extension in Swift that is restricted to one class?

不想你离开。 提交于 2019-12-10 15:49:21
问题 Can I make an Array extension that applies to, for instance, just Strings? 回答1: As of Swift 2, this can now be achieved with protocol extensions , which provide method and property implementations to conforming types (optionally restricted by additional constraints). A simple example: Define a method for all types conforming to SequenceType (such as Array ) where the sequence element is a String : extension SequenceType where Generator.Element == String { func joined() -> String { return ""

iOS App Extension - Action - Custom Data

非 Y 不嫁゛ 提交于 2019-12-10 15:47:37
问题 I'm developing an app extension as an Action . The host app will use my extension in the normal way: by presenting the UIActivityViewController to include an array of activityItems which are then passed to my extension. iOS will decide whether to present my Action based on whether the items match the NSExtensionActivationRule setting that I have defined in info.plist of the extension. This feature seems to be meant for content and pointers to content (images, videos, text, files, URLs).

No Swift settings in Xcode 5 project

妖精的绣舞 提交于 2019-12-10 15:46:54
问题 I am trying to add some Swift code to an existing project created in Xcode 5 and I get a crash whenever I try to automatically generate a bridging header. Looking in my project settings, I think it is because there are no Swift Compiler settings. Anyone know of a way to migrate a project to Xcode 6 settings or do I need to re-create the project? 回答1: The only solution I've found for this is to create a new target. Make sure to select "Swift" as the language choice for the new target.