我目前正在制作一个具有多个计时器的应用程序,基本上都是相同的.
我想创建一个自定义类,它使用定时器的所有代码以及布局/动画,因此我可以有5个相同的定时器,它们彼此独立地运行.
我使用IB(xcode 4.2)创建了布局,并且定时器的所有代码当前都在viewcontroller类中.
我很难将我的大脑包装成如何将所有内容封装到自定义类中,然后将其添加到viewcontroller,任何帮助都将非常感激.
我正在创建登录以查看支持服务单.第一个视图是故障单视图,如果您未登录,则会将您推送到登录屏幕.但是我得到了这个:
支持[3209:18e03] *由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不是密钥LoginScreen的密钥值编码兼容.*
第一掷调用堆栈:(0x1f17012 0x1634e7e 0x1f9ffb1 0x10e1711 0x1062ec8 0x10629b7 0x108d428 0x7990cc 0x1648663 0x1f1245a 0x797bcf 0x65ce37 0x65d418 0x65d648 0x65d882 0x669235 0x8683d2 0x6664f3 0x666777 0x6667b7 0x9d1fe2 0x9c3ad9 0x65e422 0x2b15 0x65f753 0x65fb2f 0x661286 0x65fe3f 0x592910 0x592895 0x5926e5 0x1edfafe 0x1edfa3d 0x1ebd7c2 0x1ebcf44 0x1ebce1b 0x22aa7e3 0x22aa668 0x57c65c 0x1f0d 0x1e35)的libc + + abi.dylib:终止调用抛出异常
这是我的LoginScreen.m代码
#import "UIAlertView+error.h"
#import "LoginScreen.h"
#import "API.h"
#include <CommonCrypto/CommonDigest.h>
#define sayWhat @"REMOVEDFORSECURITY"
@implementation LoginScreen
-(void)viewDidLoad {
NSLog(@"Found me!");
[super viewDidLoad];
//focus on the username field /show keyboard
[fldUsername becomeFirstResponder];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{ …
Run Code Online (Sandbox Code Playgroud) 我知道这个错误的意思,但我真的很挣扎,我需要别人的帮助:
2010-09-21 15:03:11.562 Stocks[5605:207] *** Terminating app due to uncaught
exception 'NSUnknownKeyException', reason: '[<NSObject 0x499fb20>
setValue:forUndefinedKey:]: this class is not key value coding-compliant
for the key actionText.'
Run Code Online (Sandbox Code Playgroud)
这里有我的代码:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
@interface AlertCell : UITableViewCell {
IBOutlet UILabel *actionText;
}
@property (retain, nonatomic) UILabel *actionText;
@end
Run Code Online (Sandbox Code Playgroud)
和
@implementation AlertCell
@synthesize actionText;
- (void)dealloc {
[actionText release];
[super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)
问题发生在那里:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
AlertCell *cell =
(AlertCell …
Run Code Online (Sandbox Code Playgroud) 我正在按照标题为"iOS的Swift教程:NSFileManager持久数据"的教程,我在29分钟左右或之后遇到错误.当我尝试在iOS模拟器上运行它时,我收到错误:
由于未捕获的异常'NSUnknownKeyException'而终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不是密钥值的编码 - 与密钥theLoadMethod兼容.
显然基于错误,我认为问题是我的theLoadMethod
.以下是我在ViewController中作为此项目的一部分编写的所有代码:
let theDocumentsFolder = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
let theFileName = "/theUserFile.txt"
let thePath = theDocumentsFolder.stringByAppendingString(theFileName)
class ViewController: UIViewController {
@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var lastNameTextField: UITextField!
@IBOutlet weak var ageTextField: UITextField!
@IBOutlet weak var theLabel: UILabel!
// The save method
@IBAction func theSaveMethod(sender: AnyObject) {
var name = nameTextField.text
var lastName = lastNameTextField.text
var age = ageTextField.text
var theString = "The user's information is: \(name), …
Run Code Online (Sandbox Code Playgroud) 我是一个非常新的xcode ...一个应用程序(简单的计算器)工作相当不错(在模拟器和设备上).当我在Target的摘要选项中设置主界面时,启动模拟器时出现以下错误:
2012-04-14 12:17:27.123 CalcTest [27550:f803] *由于未捕获的异常'NSUnknownKeyException'而终止应用,
原因:'
[<UIApplication 0x6a14650> setValue:forUndefinedKey:]
:这个类不是关键值计算器屏幕的关键值编码兼容.*第一掷调用堆栈:(0x12db022 0x18f8cd6 0x12daee1 0xcc2022 0xc33f6b 0xc33edb 0xc4ed50 0x53671a 0x12dcdea 0x12467f1 0x53526e 0x536eb7 0x313ce1 0x313ff8 0x31317f 0x322183 0x322c38 0x316634 0x27fcef5 0x12af195 0x1213ff2 0x12128da 0x1211d84 0x1211c9b 0x312c65 0x314626 0x1bad 0x1b15为0x1)终止叫做抛出异常(LLDB)
为了找到问题,我开始了一个新的基于视图的项目.
在模拟器上运行空的新项目 - >工作,
但是当我将主界面设置为ViewController时,在摘要中 - >模拟器崩溃了
2012-04-14 12:11:17.492崩溃[27494:f803] *由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:
'
[<UIApplication 0x6a6f4b0> setValue:forUndefinedKey:]
:这个类不是关键视图的键值编码兼容. *第一次抛出调用堆栈:(0x13c7022 0x1558cd6 0x13c6ee1 0x9bf022 0x930f6b 0x930edb 0x94bd50 0x23371a 0x13c8dea 0x13327f1 0x23226e 0x233eb7 0x10ce1 0x10ff8 0x1017f …
我正在尝试创建一个UICollectionViewCell
链接了一个xib 的子类,我已经这样做了:我创建了一个新的xib文件并UICollectionViewCell
在其中添加了一个,然后我创建了这个子类文件:
@interface MyCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UILabel *label;
@end
Run Code Online (Sandbox Code Playgroud)
另外我在文件所有者自定义类中链接了MyCell
接口构建器中的类,并且我添加了一个UILabel
,然后在我的UICollectionView
viewDidLoad中我这样做:
[self.collectionView registerClass:[MyCell class] forCellWithReuseIdentifier:@"MyCell"];
UINib *cellNib = [UINib nibWithNibName:@"MyCell" bundle:nil];
[self.collectionView registerNib:cellNib forCellWithReuseIdentifier:@"MyCell"];
Run Code Online (Sandbox Code Playgroud)
除此之外:
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
MyCell *cell = (MyCell*)[cv dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
cell.label.text = @"Cell Text";
return cell;
}
Run Code Online (Sandbox Code Playgroud)
但是这不起作用,我收到此错误:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSObject 0x907eca0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the …
Run Code Online (Sandbox Code Playgroud) 好吧,我会尝试尽可能简短.我想我上面的键盘UIToolbar,我花了一段时间来弄明白,我最终做到了,但是当我尝试添加功能的按钮之前的*未来*和做我的程序很快就会无法编译.
这里可以看到整个错误消息:
2012-06-20 05:36:55.276 KegCop [79460:fb03] *由于未捕获的异常'NSUnknownKeyException'终止应用程序,原因:'[setValue:forUndefinedKey:]:此类不是键值编码兼容的键完成".
*第一掷调用堆栈:(0x134a022 0x1733cd6 0x1349ee1 0xd31022 0xca2f6b 0xca2edb 0xcbdd50 0x5a571a 0x134bdea 0x12b57f1 0x5a426e 0x7adeef 0x7ae03e 0x382d7a 0x382ff8 0x38217f 0x391183 0x391c38 0x385634 0x1f84ef5 0x131e195 0x1282ff2 0x12818da 0x1280d84 0x1280c9b 0x381c65 0x383626 0x2a8d 0x29f5为0x1)终止叫做抛出异常(LLDB)
@Abizern建议我应该阅读Apple Doc on Key值编码指南.无论如何,它是超级晚,或超级早,但你看它.更新的项目可以在这里找到:https://github.com/ipatch/KegCop
只需下载zip,尝试构建,你就会看到我在说什么.该错误可能位于ViewControllerWelcome.m文件中的某处.
我正在使用教程编写一个相当简单的应用程序.我今天将应用程序复制到了我的工作计算机 它昨晚在我的笔记本电脑上完美运行,但今天我收到了这个错误.我尝试了几乎所有的代码,甚至删除了didFinishLaunchingWithOptions函数中的所有内容,但我仍然遇到了这个错误.我甚至没有在任何地方声明导航栏!我假设代码之外的某种项目或文件设置是问题?
2011-11-22 14:39:32.294 LetsEat[15320:b603] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LetsEatAppDelegate 0x5a824a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navBar.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00fa45a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010f8313 objc_exception_throw + 44
2 CoreFoundation 0x00fa44e1 -[NSException raise] + 17
3 Foundation 0x0079f677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0079f5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0021b30c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00f1a8cf -[NSArray makeObjectsPerformSelector:] + …
Run Code Online (Sandbox Code Playgroud) 我有这个
- (void)loadView {
BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString* databasePath = [documentsPath stringByAppendingPathComponent:@"ProxDeals.db"];
NSError *error;
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:databasePath];
if (fileExists==TRUE) {
[[NSBundle mainBundle] loadNibNamed:@"ProxDealsViewController" owner:self options:nil];
}
else {
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"ProxDeals.db"];
NSLog(@"%@",defaultDBPath);
success = [fileManager copyItemAtPath:defaultDBPath toPath:databasePath error:&error];
if (!success) {
NSAssert1(0, @"Failed to create writable database file with message '%@/.", [error localizedDescription]);
}
[[NSBundle mainBundle] loadNibNamed:@"UserRegistration" owner:self options:nil];
}
Run Code Online (Sandbox Code Playgroud)
}
而这个错误: …
我正在编写我的第一个iPhone应用程序,所以我还没有找到很多调试方法.基本上我的应用程序显示图像,触摸时播放短暂的声音.在XCode中编译和构建项目时,一切都成功构建,但是当应用程序在iPhone模拟器中运行时,它会崩溃.
我收到以下错误:
Application Specific Information:
iPhone Simulator 1.0 (70), iPhone OS 2.0 (5A331)
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<UIView 0x34efd0> setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key kramerImage.'
Run Code Online (Sandbox Code Playgroud)
kramerImage这里是我用于背景的图像.
我不确定NSUnknownKeyException是什么意思,或者为什么该类不是密钥值编码兼容的密钥.
iphone ×6
ios ×5
xcode ×5
cocoa-touch ×2
objective-c ×2
xib ×2
class ×1
cocoa ×1
debugging ×1
key ×1
nib ×1
swift ×1
uitableview ×1
uiview ×1