有没有人见过这种事发生过?我无法运行UITests,因为该按钮已被禁用.我没有在网上找到任何帮助.我删除并添加了一个新的测试目标,重新启动了Xcode并删除了派生数据.这些都不起作用,我不知道下一步该尝试什么.
在我的MacBook Air上的新OS X Lion上安装了Xcode 4.2,无法编译我的旧项目.创建新的单窗口项目(基于视图的应用程序) - 不做任何更改,只是尝试编译它并得到错误:
CompileXIB Test3/en.lproj/ViewController.xib
cd /Volumes/MacExt/Projects/iOS/Test3
setenv IBC_MINIMUM_COMPATIBILITY_VERSION 5.0
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
setenv XCODE_DEVELOPER_USR_PATH /Developer/usr/bin/..
/Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text --compile /Users/lial/Library/Developer/Xcode/DerivedData/Test3-fvcbdbtitujnwabzsgjgcbugfmoy/Build/Products/Debug-iphonesimulator/Test3.app/en.lproj/ViewController.nib /Volumes/MacExt/Projects/iOS/Test3/Test3/en.lproj/ViewController.xib
--sdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk
Command /Developer/usr/bin/ibtool failed with exit code 255
Run Code Online (Sandbox Code Playgroud)
尝试打开xib时出现选择内部错误:崩溃并继续
Xcode encountered an internal logic error. Choose "Continue" to continue running Xcode in an inconsistent state. Choose "Crash" to halt Xcode and file a bug with Crash Reporter. Choosing "Crash" will result in the loss of all unsaved data.
Run Code Online (Sandbox Code Playgroud)
请帮帮我,我该如何解决这个问题?Xcode不稳定吗?或者我的一些项目有不正确的设置?
我是初学iPhone应用程序开发人员,我试图通过IBAction按钮在标签上显示iPhone或App唯一标识符.我研究了一下,知道有些代码已被弃用,而是使用了CFUUID.下面的代码是我使用的.但是,每次触摸IBAction按钮时,UUID都会发生变化.我究竟做错了什么?
CFUUIDRef udid = CFUUIDCreate(NULL);
NSString *udidString = (NSString *) CFUUIDCreateString(NULL, udid);
uuid.text= udidString;
Run Code Online (Sandbox Code Playgroud) 所以我面临着在我的内部设置custum selectedBackgroundView的问题UITableViewCell.
我的单元格contentView基本上是一个UIView(frame = 0,0,80,70),黑色背景和UIImageView子视图.
imageView的 contentMode = UIViewContentModeScaleAspectFit;
这看起来像这样:

现在我像这样设置selectedBackgroundView:
//set the custom selected color
UIView *bgColorView = [[UIView alloc] init];
bgColorView.backgroundColor = MY_TINT_COLOR;
CGColorRef darkColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha: 0.25].CGColor;
CGColorRef lightColor = [self.view.backgroundColor colorWithAlphaComponent:0.0].CGColor;
//setting some gradients here
//should not be relevant for the question
[cell setSelectedBackgroundView:bgColorView];
Run Code Online (Sandbox Code Playgroud)
这导致如下所示:

我现在的问题是selectedBackgroundView隐藏黑色部分的原因是contentView什么?
我已经尝试bgColorView用一个帧开始初始化我x = 80,但这并没有改变任何东西.
此外,我曾试图显式设置backgroundColor的imageView黑色,同样的结果.
什么可能导致这种行为?
我目前正在尝试实现一个简单的两行UICollectionView.因为在使用涉及Core Data的更复杂数据源时我已经遇到过这个问题,所以我只使用了包含一些字符串的NSArray.问题仍然是一样的.
- (NSArray *)collectionViewData
{
return @[@"zero",@"one",@"two",@"three",@"four",@"five",@"six",@"seven",@"eight",@"nine",@"ten",@"eleven",@"twelve",@"thirteen",@"fourteen",@"fifteen",@"sixteen", @"seventeen"];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if (!self.collectionView) {
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
flowLayout.itemSize = CGSizeMake(160, 120);
flowLayout.minimumInteritemSpacing = 0;
flowLayout.minimumLineSpacing = 10;
self.collectionView = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:flowLayout];
self.collectionView.dataSource = self;
[self.collectionView registerClass:[BYCollectionViewCell class] forCellWithReuseIdentifier:@"CELL_ID"];
[self.view addSubview:self.collectionView];
}
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [self.collectionViewData count];
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
BYCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CELL_ID" forIndexPath:indexPath];
cell.title = self.collectionViewData[indexPath.row];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
http://bytolution.com/scrnsht.png
如您所见,单元格的顺序错误.当我将其设置minimumLineSpacing …
由于我收到错误"位置管理器错误:(KCLErrorDomain错误0)"我编辑该方案以设置默认位置.即Scheme>编辑方案>选项>允许位置模拟选中设置默认位置.
是否会影响设备从GPS获取其位置?
NSUserDefault当我的应用程序在iOS中完全退出时,我需要保存.不是didenterbackground和foreground.仅当用户在iOS中使用减号( - )符号终止我的应用时.
所以,我写在下面的代码applicationWillTerminate中AppDelegate.
- (void)applicationWillTerminate:(UIApplication *)application
{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"iCloud"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
Run Code Online (Sandbox Code Playgroud)
但它并没有节省NSUserDefault.
那么我应该在哪里写保存我的数据?
我已经阅读了很多关于ios7 SQLite/Core Data堆栈中新的WAL默认设置的主题.
首先它看起来是个好主意......虽然我需要根据我的业务需求不时地向远程Web服务执行数据库副本.目前我只备份SQLITE文件,我无法将其他2个文件添加到我正在使用的webservice操作中.这意味着我的备份显然不是最新的,因此毫无意义.
其他人建议我应该使用journal_mode = DELETE(NSSQLitePragmasOption)禁用WAL,这对我来说是一个可接受的解决方法.不过,我对此并不满意.感觉就像我错过了相当不错的表现.
理想情况下,我希望能够告诉Core Data/SQLite将SHM/WAL同步到主数据文件,然后执行备份.有没有办法在不挖掘疯狂的私有或未记录的API的情况下这样做?
我正在使用 Parse 和 Xcode 构建一个应用程序。使用 ParsePFTableView时出现错误:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“*** setObjectForKey:对象不能为零(键:类名)”
我知道我没有在代码中的某处设置密钥,但我不知道在哪里以及如何修复它。
#import "TableViewController.h"
#import <Parse/Parse.h>
@interface TableViewController ()
@end
@implementation TableViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// This table displays items in the Todo class
self.parseClassName = @"Todo";
self.pullToRefreshEnabled = YES;
self.paginationEnabled = YES;
self.objectsPerPage = 25;
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line …Run Code Online (Sandbox Code Playgroud) 我正试图在OS X上获得金链接器.我尝试了两个brew install binutils(有效,但没有金链接器)并从git head安装(失败).