spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » XCODE » Page 1
How do you get the return key to execute code in Swift?
for a UITextField: a UITextFieldDelegate has the method textFieldShouldReturn: that is called . Do your stuff and return NO to prevent a newline / yes for multiline - (BOOL)textFieldShouldReturn:(UITextField*)field { //DO your stuff return NO; // yes to allow enter } for a UITextView: the delegate has - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replac

Categories : Xcode

Xcode 6.1?? Why does the NSTableView show only placeholder text?
In Xcode 5 and earlier, when you drag a table view out of the Object library in Interface Builder, it is an NSCell-based table view by default. In Xcode 6 and later, it's a view-based table view by default, with the cell views being NSTableCellViews with NSTextFields as subviews. You can configure the "content mode" of the table view on the Attributes inspector at any time. Furthermore, with tha

Categories : Xcode

XCode 6 - Delay iterations in a loop?
So to understand why you are getting this behavior, you need to understand the idea of the run loop. Every app has a run loop that is essentially an infinite loop. Each iteration of the loop, it does a number of things. Two of the primary things are handling events (like tapping a button) and updating the GUI. The GUI is updated only once per run loop. Your event handling code (for tapping btnSta

Categories : Xcode

Sticking Node to another Node when Colliding
Implement the SKPhysicsContactDelegate protocol: class GameScene: SKScene, SKPhysicsContactDelegate Set the delegate at the end of didMoveToView override func didMoveToView(view: SKView) { ... self.physicsWorld.contactDelegate = self } Create global variables to store the collision categories: let collisionCar: UInt32 = 0x1 << 0 let collisionPlayer: UInt32 = 0x1 << 1

Categories : Xcode

XCode 6 - issue with registering a touch
User interaction is disabled by default for UIViews and its descendants, you have to explicitly enable it: // create the bugs let bugs = UIImageView() bugs.image = UIImage(named: "bug") bugs.frame = CGRectMake(0-size, yPosition, size, size) bugs.userInteractionEnabled = true // <-- self.view.addSubview(bugs)

Categories : Xcode

Localization not working for XIB file in XCode 6
Same here. For now I use localized XIB files where I have to, because some of my xib's are working properly with .strings files. Sad thing that this bug was found almost year ago here.

Categories : Xcode

NSTimer timeInterval parameter doesn't allow variable
If you look at the scheduledTimerWithTimeInterval signature: class func scheduledTimerWithTimeInterval(ti: NSTimeInterval, target aTarget: AnyObject, selector aSelector: Selector, userInfo: AnyObject?, repeats yesOrNo: Bool) -> NSTimer you notice that the method doesn't have an external name for the first parameter (that's default for methods), so you don't have to use the timeInterval exter

Categories : Xcode

Can't find "Foundation" option while creating Objective-C Project in XCode 6
Foundation is just one of Apple's frameworks. I assume it's the BNR book about Objective-c (great book btw), in which case I think the type you're looking for is a Command Line Tool project. It uses the Foundation framework by default. I found an old image of Xcode where there used to be a drop down menu to select type, but it seems to have been removed from the newer version of Xcode.

Categories : Xcode

Delay Actions in Swift
dispatch_after() is the standard way of delaying actions. indicator.startAnimating() let delay = 4.5 * Double(NSEC_PER_SEC) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay)) dispatch_after(time, dispatch_get_main_queue()) { indicator.stopAnimating() } See: dispatch_after - GCD in swift?

Categories : Xcode

Is it possible to install Xcode 6 on Snow Leopard?
No, this is not possible. Xcode 6 requires OS X 10.9.3 or later or OS X 10.10 and cannot be installed on any version of OS X earlier than this. (Source)

Categories : Xcode

error using < and >
you've defined "guess" as a UITextField, which is certainly not the same type as "random". You need to tell the compiler how to convert that to an integer. Something like: let guessInteger = guess.text.toInt() and then: if guessInteger > random { println("(guess.text) was too high. Try again") }

Categories : Xcode

Trouble downloading XCode 6.1 on Mac OS X Yosemite
It might be network error You can download directly it with this links Or you can download .dmg files directly without such errors Xcode 6 Xcode 6.1 link 6.0.1 link Xcode 5 5.1.1 link 5.0.2 link Xcode 4 4.6.3 link 4.5.2 link 4.4.1 link 4.3.2 link

Categories : Xcode

Xcode Method definition 6 end
When Xcode builds your project, it creates a folder, compiles all of your code into files in that folder, and links them into your app. When you change your code, it only has to recreate the affected files and link them again. However, sometimes there can be a glitch where files don't update, causing your code to have errors when there really isn't an error at all. Pressing Shift-Command-K (Cle

Categories : Xcode

Use Variable in viewDidLoad
You need to either declare test2 as an instance variable, alongside your two labels, or assign the text property of etikket2 inside viewDidLoad: Method 1: class ViewController: UIViewController { @IBOutlet weak var etikett1: UILabel! @IBOutlet weak var etikett2: UILabel! let test2 = "hello 2" @IBAction func button(sender: UIButton) { let test1 = "hello 1" etikett

Categories : Xcode

"self" object for UIViewcontroller has @"0 objects" in debug window in xcode
It seems you did copy&paste some controls from other viewcontroller into the viewcontroller in the storyboard and xCode confused about the controls. Following steps maybe help you. Restart xCode. Open the storyboard. Select all controls in the viewcontroller and delete them. Undo delete.

Categories : Xcode

Git diff is present on symbolic links on Windows but not on Mac on FAT file system
Here is explanation of the problem: http://www.tucuxi.org/os-x-vfat/ In two words FAT has no understanding of Symbolic Links and hence when you copy symbolic link onto FAT is tries to mimic with add the content mention is the diff in above images. Here is the solution: https://www.kernel.org/pub/software/scm/git/docs/git-config.html In tow words, git core.symlinks config should be set false, so

Categories : Xcode

Xcode 6.1: file was built for x86_64 which is not the architecture being linked (i386)
Make sure you have i386 and x86_64 listed in your Architectures in Build settings for your lib. Also set Build Active Architecture Only explicitly to No.

Categories : Xcode

Filtering CoreData Fetch with parentEntities
Not sure if there's a way of conditionally specifying a relationship in the predicate (which would allow a single fetch request to do this), but below is possibly a way to fetch the objects you need in multiple fetches. The idea is to iterate through all of the entities in the managed object model and check if they have the TopObject relationship and are of the SubObject class, then fetch them bas

Categories : Xcode

RSS feed does not load to the WebView correctly
Did you use 'http://chicago.craigslist.org/search/ata?format=rss'? or 'http://chicago.craigslist.org/search/ata?format=rss&amp;format=rss' ? You have to probably use the second one, because it specifies the category.

Categories : Xcode

TableViewController and CustomCell using Swift
Just for future searches here is how it was solved: Created new class: import UIKit class DeviceCustomCell: UITableViewCell { @IBOutlet var myLabel1: UILabel! @IBOutlet var myLabel2: UILabel! @IBOutlet var myButton: UIButton! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(selected: Bool, animated: Bool) { super.setSelected

Categories : Xcode

Error with cast operator and std::string in a class
You can use explicit conversion explicit operator std::string() ~~~~~~~ { return std::string("Huhuhu"); }

Categories : Xcode

what is differant 'import Cocoa' and 'import Foundation' in Xcode's Playground
Your playground is most likely created for the iOS platform - Cocoa is a framework for the OS X target, and its iOS counterpart is UIKit, and both contain user interface related APIs (for the respective platform). Try changing that to: import UIKit and it should work. Foundation is a framework containing several APIs, such as NSString, NSDate, NSDateFormatter. It is already included in Cocoa a

Categories : Xcode

XCode 6 on Yosemite : support of C++11 is broken?
You haven't told the compiler what the minimum OSX target will be. In order to use libc++ that must be 10.7 as that's the first version of OSX the library was shipped on. The command line option you need to add is: -mmacosx-version-min=10.7 I am unsure how you get that option to clang using QMake, however according to this, it's done by tweaking the mkspec: question: I would like to add

Categories : Xcode

Alertview for textfiled works on ios7 but not working on ios6.1
You can't easily alter the view hierarchy of a UIAlertView in iOS 7. (Nor should you; the documentation specifically tells you not to.) Head over to the developer forums to see a long discussion about it. One alternative in your case is to set alert.alertViewStyle = UIAlertViewStylePlainTextInput; This will add a text field for you. You can access it in the UIAlertView delegate callback by using

Categories : Xcode

xcode 6 missing main.swift file for new projects
You don't necessarily need a main.swift file. The main (heh) purpose of that file is to call NSApplicationMain(), the function that gets a Cocoa app up and running. But, since every app needs to do that, Apple added a less-boilerplate way of doing things. Now, you just need to label your app delegate class with the @NSApplicationMain attribute. Then Xcode will build in the right hooks to get you

Categories : Xcode

Node not moving after changing scenes
You're calling your swipedUp1 (etc) methods on the wrong scene. Here's what's happening: Your view controller has a reference to the GameScene instance that you start with. Its gesture action methods call to that, and all is well. When you start a new game from GameOverScene, that creates a new instance of GameScene and presents it in the view. Now you have two instances of GameScene: the one y

Categories : Xcode

Xcode 6 Swift Errors
It's true, false and Bool, not TRUE, True, FALSE, False and / or BOOL, regardless of what the autocomplete tells you ;)

Categories : Xcode

Push notification through Parse using TestFlight
I'm answering my own question: Your provisioning profile must contain a push certificate for production/ distribution (still has to be a developer profile though) . Since test flight works on a production level it won't work with just a developer push certificate (add both). Any other question on this just ask. I've gone through a lot of trouble shooting

Categories : Xcode

Changing image of UIButton via click - XCode 6 Swift
To permanently change the button image on tap, you have to use the .Normal enum case and not .Highlighted for the control state: sender.setImage(coin,forState: UIControlState.Normal) Setting the image for the .Highlighted state makes the new image appear only when the button is in that state, i.e. when it is tapped.

Categories : Xcode

Missing debug metadata in llvm after xcode update
While I'm still not comfortable with the solution, I've hacked LLVM code and removed the call to llvm::UpgradeDebugInfo method from BitcodeReader::MaterializeModule code. Of course I may be punished for this if some truly incompatible LLVM compiler is used, but for now it works, furthermore not only clang from XCode can be used, but as well I can use Clang from LLVM release page which also produce

Categories : Xcode

NSBundle UIImage nil iOS 7 specific
The documentation for imageNamed says: The name of the file. If this is the first time the image is being loaded, the method looks for an image with the specified name in the application’s main bundle. It doesn't say anything about loading from a full path. Can you use: + (UIImage *)imageWithContentsOfFile:(NSString *)path instead?

Categories : Xcode

Error during cast of an object to std::string with proper operator-overloading
std::string have multiple constructors taking single arguments, and since you provide both a conversion operator for std::string and a generic any-type conversion operator, the compiler simply don't know which constructor to pick.

Categories : Xcode

IOS 8 / 7 unique user identifier
You can use UUID.Its important to save UUID in NSUserDefault once generated because UUID will be different for each generation. + (NSString*)getAppUUID { NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; NSString *uuid = [userDefaults objectForKey:NSLocalizedString(@"DeviceToken",nil)]; if(!uuid) { CFUUIDRef uuidRef = CFUUIDCreate(NULL); CFStri

Categories : Xcode

ABRecordCopyValue not working when object doesn't exist
ABRecordCopyValue can actually return nil so you should unwrap it. Also, casting to String didn't work for me so I'm using NSString. if let firstName = ABRecordCopyValue(abContact, kABPersonFirstNameProperty)?.takeRetainedValue() as? NSString { println("FIRST NAME: (firstName)") } else { println("No Name") } Another thing you could try is instead of getting the first and lastName individual

Categories : Xcode

Specific letters that have each specific colors?
Assuming you are using UILabel named myLabel: let str = "This is a string" let colors:[UIColor] = [ .blackColor(), // T .darkGrayColor(), // h .lightGrayColor(), // i .grayColor(), // s .clearColor(), // .redColor(), // i .greenColor(), // s .clearColor(), // .blueColor(), // a .clearColor(), // .cyanColor(),

Categories : Xcode

How do I resolve what particular directory Xcode's -FLibrary is complaining about?
Your snapshot is not clear so not able to see what exact problem you are facing. But from the description of it, it looks like that your compiler is not able to locate the framework for you. So try this:: Remove the framework from you project, just delete it completely. Clean your project. Add it again.

Categories : Xcode

Unable to use Control key as the key equivalent for an NSButton in a xib file
From the human interface guidelines: As much as possible, avoid using the Control key. Because the Control key is already used by some of the universal access features—as well as in Cocoa text fields where Emacs-style key bindings are often used—it should be used as a modifier key only when necessary. So, while the behavior of Xcode isn't very nice in this regard, it is probably just try

Categories : Xcode

Xcode 6.1.1 shortcut cmd+click on a function name doesn't work anymore
It definitelly works. But you could try keyboard-only solution: Preferences > Key bindings > Find > Jump to definition and also you can set it up there.

Categories : Xcode


Recently Add
Is it possible to run Swift testcases from command line without an Xcode project?
How do you get the return key to execute code in Swift?
Xcode 6.1?? Why does the NSTableView show only placeholder text?
XCode 6 - Delay iterations in a loop?
Sticking Node to another Node when Colliding
XCode 6 - issue with registering a touch
Localization not working for XIB file in XCode 6
NSTimer timeInterval parameter doesn't allow variable
Can't find "Foundation" option while creating Objective-C Project in XCode 6
Delay Actions in Swift
Is it possible to install Xcode 6 on Snow Leopard?
error using < and >
Trouble downloading XCode 6.1 on Mac OS X Yosemite
Xcode Method definition 6 end
Use Variable in viewDidLoad
"self" object for UIViewcontroller has @"0 objects" in debug window in xcode
Git diff is present on symbolic links on Windows but not on Mac on FAT file system
Xcode 6.1: file was built for x86_64 which is not the architecture being linked (i386)
Filtering CoreData Fetch with parentEntities
RSS feed does not load to the WebView correctly
TableViewController and CustomCell using Swift
Error with cast operator and std::string in a class
what is differant 'import Cocoa' and 'import Foundation' in Xcode's Playground
XCode 6 on Yosemite : support of C++11 is broken?
Alertview for textfiled works on ios7 but not working on ios6.1
xcode 6 missing main.swift file for new projects
Node not moving after changing scenes
Xcode 6 Swift Errors
Push notification through Parse using TestFlight
Changing image of UIButton via click - XCode 6 Swift
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.