xcode6

Get an Int out of an UILabel Swift

ぐ巨炮叔叔 提交于 2019-12-20 02:47:05
问题 I have the problem, to have a high amount of buttons which have a number as their label, so i thought i could take the label as an integer instead of creating an action for every button?! @IBAction func NumberInput(sender: UIButton) { var input:Int = sender.titleLabel as Int } 回答1: If you want to do this, you can convert the string to an Int by using string.toInt() such as: if let input = sender.titleLabel?.text?.toInt() { // do something with input } else { // The label couldn't be parsed

Simple Swift class does not compile

走远了吗. 提交于 2019-12-20 02:19:05
问题 My simple class, ClassWithOneArray, produces this error: Bitcast requires both operands to be pointer or neither %19 = bitcast i64 %18 to %objc_object*, !dbg !470 LLVM ERROR: Broken function found, compilation aborted! Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 1 However, my class, ClassWithOneInt, does not. Why? class ClassWithOneInt { var myInt = Int() init(myInt: Int) { self.myInt = Int() } func

BOOST_ERROR_CODE_HEADER_ONLY does not have the advertised effect

断了今生、忘了曾经 提交于 2019-12-19 21:59:09
问题 In my app I include boost/system/error_code.hpp (boost 1.58) but don't want to link to boost_system, but instead have a header-only solution. I read by defining BOOST_ERROR_CODE_HEADER_ONLY that should be possible. But unfortunately, it does not work as expected. I still get a linker error for boost::system::system_category(). I wonder if that is supposed to work at all and if so how. The code in the boost header is: # ifdef BOOST_ERROR_CODE_HEADER_ONLY inline const error_category & system

xCode: Library not found - lPods-Bolts - Exit Code 1

主宰稳场 提交于 2019-12-19 19:46:10
问题 Hi I'm having this issue: ld: library not found for -lPods-Bolts clang: error: linker command failed with exit code 1 (use -v to see invocation) However, I downloaded the Bolt package from the Facebook Docs and put it into my supporting files. In addition, I'm using Cocoapods so I also downloaded Bolt using Cocoapods. Ld /Users/mmk88/Library/Developer/Xcode/DerivedData/Jobazo-gejnfogovpyqypgovssmomabbuhl/Build/Products/Debug-iphoneos\ /Jobazo.app/Jobazo normal arm64 cd /Users/mmk88/Desktop

How to convert unmanaged<CFData> to NSData?

喜你入骨 提交于 2019-12-19 18:50:40
问题 I need to convert my Objective-C to Swift to get an image of a contact from the Address Book. But I get an error with for cast from CFData to NSData and I don't know how make this work. What can I do to make this work correctly? In Objective-C: ABRecordID contactID = ABRecordGetRecordID(contactRef); ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef origContactRef = ABAddressBookGetPersonWithRecordID(addressBook, contactID); if (ABPersonHasImageData(origContactRef)) { NSData

How to convert unmanaged<CFData> to NSData?

人走茶凉 提交于 2019-12-19 18:50:29
问题 I need to convert my Objective-C to Swift to get an image of a contact from the Address Book. But I get an error with for cast from CFData to NSData and I don't know how make this work. What can I do to make this work correctly? In Objective-C: ABRecordID contactID = ABRecordGetRecordID(contactRef); ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef origContactRef = ABAddressBookGetPersonWithRecordID(addressBook, contactID); if (ABPersonHasImageData(origContactRef)) { NSData

How to convert unmanaged<CFData> to NSData?

穿精又带淫゛_ 提交于 2019-12-19 18:50:09
问题 I need to convert my Objective-C to Swift to get an image of a contact from the Address Book. But I get an error with for cast from CFData to NSData and I don't know how make this work. What can I do to make this work correctly? In Objective-C: ABRecordID contactID = ABRecordGetRecordID(contactRef); ABAddressBookRef addressBook = ABAddressBookCreate(); ABRecordRef origContactRef = ABAddressBookGetPersonWithRecordID(addressBook, contactID); if (ABPersonHasImageData(origContactRef)) { NSData

Swift Mac OSX NSButton title color

血红的双手。 提交于 2019-12-19 17:42:30
问题 I would like to know how to change title color to a NSButton in swift, I've seen lots of examples in objective-c but I think in swift the implementation is different, can anyone provide me an example? 回答1: try this in viewDidLoad or somewhere. In Swift 3: let pstyle = NSMutableParagraphStyle() pstyle.alignment = .center button.attributedTitle = NSAttributedString(string: "Title", attributes: [ NSForegroundColorAttributeName : NSColor.red, NSParagraphStyleAttributeName : pstyle ]) 回答2: Swift 4

XCode 6 Crashes on Source Control

我与影子孤独终老i 提交于 2019-12-19 10:47:19
问题 I am getting very frequent crashes on XCode 6.01 especially when ever I try go to Source Control. I am using SVN. Is there a workaround I could use ? Is this a known issue ? 回答1: It is probably related to the .xccheckout file. If the project is a xcworkspace, it is located in the xcshareddata folder inside the xcworkspace bundle. If the project is a xcodeproj, it is located in the project.xcworkspace folder in the xcodeproj bundle. (The following trick seems to have fixed it for me: quit

#import <libxml/tree.h> file not found after xcode 6.1 update

断了今生、忘了曾经 提交于 2019-12-19 10:12:20
问题 I am getting lexical or preprocessor issue i.e file not found after xcode 6.1 update. i have followed below stack overflow solution but no luck. #import <libxml/tree.h> file not found after xcode update i found libxml2.2.dylib --> it is created during xcode 5 installation. libxml2.dylib --> it is created during latest xcode6 update. Using finder /usr/lib/ I had used libxml2.2.dylib in xcode 5 but now i am getting above error in xcode 6. Also how to add libxml2.2.dylib lib from this /usr/lib/