ios8

iOS Swift Error: 'T' is not convertible to 'MirrorDisposition'

旧巷老猫 提交于 2019-12-06 04:14:39
问题 I am attempting to create an extension method for the Array type to allow for removing an item from an array extension Array { func remove(item: AnyObject) { for var i = self.count - 1; i >= 0; i-- { if self[i] == item { self.removeAtIndex(i) } } } } On the test condition if self[i] == item , I get the following error: 'T' is not convertible to 'MirrorDisposition' I've tried many different things, which include: Using generics: remove<T>(item: T) Using the === operator, which just gives the

iOS8 and Safari no longer working with Bluetooth scanner

心已入冬 提交于 2019-12-06 04:14:34
问题 I have a Web app that uses a bluetooth Opticon Scanner (http://www.opticonusa.com/products/companion-scanners) The user taps into a field and scans a barcode and then the App does stuff with it. Works GREAT under iOS7 and Safari. No longer works under iOS8 and Safari. On scanning it often (but not always) drops off the last couple characters. The number of characters it drops seems somewhat random. Sometimes it does work. Very odd. I went to other sites - yahoo.com, google.com and scanned

Apple Binary Rejected (2.16)

烂漫一生 提交于 2019-12-06 04:06:15
问题 My app requires users current location to show him direction to a particular location in google map Below is the code to show location on web view- [self.getDirectionsWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude,self.projectLatitude,self.projectLongitude]]]]; The app declares support for location in .plist by using

prevent automatic UILabel font changes after setting the attributedText

浪尽此生 提交于 2019-12-06 04:04:38
问题 I've figured out that if I set an attributed text to an UILabel , the predefined font will be changed to the font of the first character of attributed text. for example: // the font size is set to 20 in Interface Builder println(theLabel.font.pointSize); var styledText = NSMutableAttributedString(string: "$100"); var smallFont = UIFont(name: theLabel.font.fontName, size: theLabel.font.pointSize / 2)!; styledText.addAttribute(NSFontAttributeName, value: smallFont, range: NSMakeRange(0, 1));

KVO with shared NSUserDefaults in Swift

岁酱吖の 提交于 2019-12-06 04:03:13
问题 I am having issues communicating between my host app and its extensions through communicating NSUserDefaults changes. I initialized NSUserDefaults using init(suiteName:) , added KVO observer using the addObserver(...) method and overrided the method observeValueForKeyPath(...) but the method observeValueForKeyPath(...) is not called when I change the value corresponding to the observing key . It will be greatful if you help me to resolve this. PS:here suite name is App groups name and

Custom button in AVPlayerViewController.ContentOverlayView

自古美人都是妖i 提交于 2019-12-06 03:38:43
I need to add a custom button to the AVPlayerViewController that will appear in both fullscreen and non-fullscreen for an app running iOS 8. Adding a button to the AVPlayerViewController.view or the containing view will work for non-fullscreen but when the player switches to fullscreen the button is no longer visible. I have found that if I add a button to the AVPlayerViewController.ContentOverlayView then it appears in fullscreen and non-fullscreen, but then it doesn't appear that the ContentOverlayView responds to any touches so the button cannot be clicked. Does anyone know of a different

How to lock device orientation in iOS 7 and iOS 8

ぃ、小莉子 提交于 2019-12-06 03:37:32
I have a problem with my app. I cannot lock the orientation of my app. All I need to do is to lock one view controller to landscape mode and the rest are portrait. This is hierarchy of my app. *Navigation Controller *TabBarController *ViewControllers You only have to return NO from shouldAutorotate and the landscape orientation from supportedInterfaceOrientation in the one you want to be in landscape. On the other, return NO too from shouldAutorotate method and portrait orientations mask from supportedInterfaceOrientation . In all the viewControllers : -(BOOL)shouldAutorotate { return NO; } In

xcodebuild fails to build from terminal but succeeded from xcode

不问归期 提交于 2019-12-06 03:26:24
问题 I'm trying to build a framework using xcode 6-beta 3 when compiling it using xcode it works but when compiling it from a terminal with the command: xcodebuild -project <projName> -scheme <schemeName> -configuration Debug clean build I'm getting the following error CodeSign error: entitlements are required for product type 'Framework' in SDK 'Simulator - iOS 8.0'. Your Xcode installation may be damaged. and the build fails to complete. at the end of the log it says The following build commands

Xcode SpriteKit - Removing Sprites and stopping an action - repeatActionForever

杀马特。学长 韩版系。学妹 提交于 2019-12-06 02:46:18
问题 I am new to Swift and SpritKit and having a few issues with my game. In my didMoveToView(view: SKView) { } section of my code I call the below statement which populates monsters on the screen. In my func addMonster() { } The monsters then animated to move from the right hand side, to the left hand side of the screen. Once they are off the screen the opposite side, the sprite gets removed. CODE A runAction(SKAction.repeatActionForever( SKAction.sequence([ SKAction.runBlock(addMonster),

How to pass array by reference without function ? swift

偶尔善良 提交于 2019-12-06 02:44:10
I have this class: class MainView:UIView{ var categories:[Category]! } i want to set the categories arg, but i need to pass it by reference not value. because it's more efficient and better. so if i did this: let mainView = MainView() mainView.categories = categoriesData. then it pass it by value. if i need to pass it by reference i could do that by using function inside the MainView() class MainView:UIView{ var categories:[Category]! fun setCategories(inout categories: Int){ self.categories = categories; } } but if i don't want to use set function, How could i pass it by reference. e.g