cs193p

Swift NSUnknownKeyException - setValue:forUndefinedKey

£可爱£侵袭症+ 提交于 2020-05-24 05:18:36
问题 I'm very new to swift, and I'm doing the Stanford course on iTunes U. I've been following along fine, but I've encountered an error that I'm unable to understand: 2015-06-29 18:45:35.080 calculator2[9780:4828233] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<calculator2.ViewController 0x7fae561041b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key enter.' I've uploaded my repo to github here. Any help is very much

errors creating a delegate from UISplitViewDetail to master in Swift

我只是一个虾纸丫 提交于 2020-02-08 03:35:06
问题 SWIFT / IOS 8.2 I am trying to set my CalculatorViewController as the delegate target so I can get data - but I seem to be setting it wrong: "EXC_BAD_ACCESS (code:2)" (in GraphView.swift) protocol CalculatorViewDataSource: class { func calculateYForXEquals(sender: CalculatorViewController, currentX: CGFloat) ->CGFloat? } class GraphView: UIView { weak var calculatorViewDataSource: CalculatorViewDataSource? //... } (in GraphViewController.swift) class GraphViewController: UIViewController {

Why UILabel is not initialized?

自古美人都是妖i 提交于 2020-01-11 04:01:09
问题 The code is from Stanford CS193p. I added a NSLog to check it out. The label seems not being initialized. Any idea? @interface AskerViewController() <UITextFieldDelegate> @property (weak, nonatomic) IBOutlet UILabel *questionLabel; @property (weak, nonatomic) NSString *question; @end @implementation AskerViewController @synthesize questionLabel = _questionLabel; @synthesize question = _question; - (void)setQuestion:(NSString *)question { _question = question; self.questionLabel.text =

isKindOfClass and NSStringFromClass disagree about UIApplicationDelegate

笑着哭i 提交于 2020-01-09 19:26:08
问题 I was playing with a simple OCUnit test for an iPhone app, and just wanted to assert that the app delegate was an instance of the class that I expected it to be. I didn't expect this test to be very useful, but it turned out to reveal a misunderstanding that I have regarding Objective C. I first get a reference to the delegate. Then I log the class name of what comes back. In my case, the output correctly says "app delegate's class name is CalculatorAppDelegate". However, the assertion on the

isKindOfClass and NSStringFromClass disagree about UIApplicationDelegate

冷暖自知 提交于 2020-01-09 19:23:46
问题 I was playing with a simple OCUnit test for an iPhone app, and just wanted to assert that the app delegate was an instance of the class that I expected it to be. I didn't expect this test to be very useful, but it turned out to reveal a misunderstanding that I have regarding Objective C. I first get a reference to the delegate. Then I log the class name of what comes back. In my case, the output correctly says "app delegate's class name is CalculatorAppDelegate". However, the assertion on the

No candidates produce the expected result

自闭症网瘾萝莉.ら 提交于 2020-01-06 02:51:09
问题 I've looked at this answer, but since I am new to Swift and am following along code that should work from Stanford CS193's course, I'm a bit confused. This is from an exercise that involves building a calculator. In the model I have these functions: private func evaluate() -> Double? { let (result, remainder) = evaluate(opStack) return result } func pushOperand(operand: Double) { opStack.append(Op.Operand(operand)) return evaluate() } func performOperation(symbol: String) { if let operation =

UIViewController throwing unrecognized selector exception on prepareForSegue

老子叫甜甜 提交于 2020-01-02 02:46:26
问题 I'm trying to follow along the Stanford CS193p iOS programing lectures. One of the demo programs, called "Happiness" creates two UIViewControllers, a "PsychViewController" and a "HappinessViewController." It segues from the PsychViewController to the HappinessViewController using a target action method. The following code keeps throwing this exception: "-[UIViewController setHappiness:]: unrecognized selector sent to instance" Here's the offending code: -(void)prepareForSegue:

CS193P UITabBarController MVC Help on Assignment 4

风流意气都作罢 提交于 2019-12-25 08:47:23
问题 I'm going through the Stanford CS193P course on iTunesU and am a little puzzled on how to do the recently viewed photos portion on assignment 4. In the assignment we are to have a tab bar controller with two tabs. 1st tab is a navigation controller that will show a table of places, which will push a table of photo names, which will push a scroll view with a photo 2nd tab is a navigation controller that will show a table of recently viewed photos, which will push a scroll view with a photo. I

IOS:CS193p fall2013 assignment2 task2:add a button to let user to restart the game

ⅰ亾dé卋堺 提交于 2019-12-25 03:53:43
问题 I am learning the course CS193P(IOS develop) on itunes and I just started assignment2. I got stuck on the task that asks me to restart the game. A little bit background on the project: I am writing code for the newly added action method for the restart button in my CardGameViewController. I have two private properties: game and deck . I use lazy initialization in the CardGameViewController to initialize them when user first touch a button(flip a card).(The original project that the professor

NSURLErrorDomain Error Code -1005

点点圈 提交于 2019-12-25 01:41:30
问题 I'm working on the CS193p coursework from Stanford (I'm not a Stanford student I'm just trying to learn), assignment number 5, where we have to get images from Flickr using calls to the Flickr api. I'm only trying to download a list of the pictures and print them out to the console, but I'm getting an NSURLErrorDomain with code -1005. The error message I am printing out is below: error: Error Domain=NSURLErrorDomain Code=-1005 "The operation couldn’t be completed. (NSURLErrorDomain error