小编bsh*_*ley的帖子

升级到Lion(Xcode4.1)后出现"数据模型版本编译"..错误

自昨天升级到Lion(10.6-> 10.7)以来,我一直无法编译在升级之前编译没有问题的项目.

这个项目最近的变化甚至不会导致这个错误:如果我从几天或一周前从SVN签出一个项目版本,我在构建时会遇到同样的错误:

"Command /Developer/usr/bin/momc failed with exit code 6",扩展到以下内容:

构建错误:

DataModelVersionCompile /Users/ian/Library/Developer/Xcode/DerivedData/inventory-gtvznzuhomhlakbdpocaqwnrihhx/Build/Products/Debug-iphonesimulator/inventory.app/inventory.momd inventory/inventory.xcdatamodeld
cd /Users/ian/AppsDev/uk.co.isurvey-inventory/ios/inventory/trunk/inventory
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/usr/bin/momc -XD_MOMC_SDKROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -XD_MOMC_IOS_TARGET_VERSION=4.3 -MOMC_PLATFORMS iphonesimulator -MOMC_PLATFORMS iphoneos -XD_MOMC_TARGET_VERSION=10.6 /Users/ian/AppsDev/uk.co.isurvey-inventory/ios/inventory/trunk/inventory/inventory/inventory.xcdatamodeld /Users/ian/Library/Developer/Xcode/DerivedData/inventory-gtvznzuhomhlakbdpocaqwnrihhx/Build/Products/Debug-iphonesimulator/inventory.app/inventory.momd

2011-07-21 19:24:44.954 momc[4436:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSXMLDocument initWithData:options:error:]: nil argument'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff8e411986 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff8d0d5d5e objc_exception_throw + 43
2   CoreFoundation                      0x00007fff8e4117ba +[NSException raise:format:arguments:] + 106
3   CoreFoundation                      0x00007fff8e411744 +[NSException raise:format:] + 116
4 …
Run Code Online (Sandbox Code Playgroud)

compiler-errors objective-c xcode4 osx-lion

13
推荐指数
1
解决办法
1万
查看次数

测试创建的对象是否为零

我正在使用此代码

    if (managedObject == nil) {
        NSLog(@"foooo");
    }
Run Code Online (Sandbox Code Playgroud)

测试创建的managedObject是否为nil.但我永远不能打印这个Fooooo.你知道我做错了什么吗?

iphone testing null objective-c ios

11
推荐指数
1
解决办法
7892
查看次数

使用 Xcode 的 Swift 包中没有此类模块 - 依赖项中列出的包

我创建一个空白模板包:

\n
> swift package init --name Temp\n> open Package.swift\n
Run Code Online (Sandbox Code Playgroud)\n

Xcode 版本 13.2.1 (13C100) 打开该包。

\n

我向包添加了依赖项。

\n
dependencies: [\n    .package(url: "https://github.com/johnsundell/publish.git", from: "0.7.0")\n],\n
Run Code Online (Sandbox Code Playgroud)\n

此时 Xcode > Product > Build 成功。

\n

我编辑Temp/Sources/Temp/Temp.swift以插入在 中定义的包的第一行dependencies

\n
import Publish\n
Run Code Online (Sandbox Code Playgroud)\n

现在构建会生成以下错误:\xe2\x80\xa6/Temp/Sources/Temp/Temp.swift:1:8: error: no such module \'Publish\'

\n

我确信这是苹果的一个错误。或者我可能会错过一些东西。

\n

当有xcodeproj和 提供的附加结构时,有几篇关于此问题的帖子。其中一些暗示了可以帮助某些人的解决方法。

\n

有没有人看到过这个和/或知道如何解决它?

\n

Apple 的使用 Xcode 创建独立的 Swift 包文档没有提供任何见解。

\n

xcode swift swift-package-manager swift-package

7
推荐指数
1
解决办法
3857
查看次数

UICollectionViewController无法从NIB有效加载

iOS 6.0,在iPhone 5上测试

我正在UICollectionViewController从一个笔尖加载一个子类.当我加热awakeFromNib方法时,它声称视图已加载.致电collectionView回报nil.

因此,我在注册加载我的细胞的笔尖时遇到了问题.

- (void)awakeFromNib {
  if ([self isViewLoaded])
    NSLog(@"[%@ %@] registered with %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd),
          self.collectionView);

  UINib *nib = [UINib nibWithNibName:@"MyCollectionCell" bundle:nil];
  [self.collectionView registerNib:nib forCellWithReuseIdentifier:NIB_ID];
}
Run Code Online (Sandbox Code Playgroud)

上面的输出:

2012-09-22 19:21:49.129 myApp[7182:907] [MyCollectionViewController awakeFromNib] registered with (null)
Run Code Online (Sandbox Code Playgroud)

此外,loadView并且viewDidLoad不会被调用(从笔尖加载时预期).

尝试加载单元格时,我失败了.

当前的解决方法,冗余注册nib collectionView:cellForItemAtIndexPath::

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  UINib *nib = [UINib nibWithNibName:@"MyCollectionCell" bundle:nil];
  [collectionView registerNib:nib forCellWithReuseIdentifier:NIB_ID];
Run Code Online (Sandbox Code Playgroud)

问题:你遇到过这个问题吗?你看到我的方式错误了吗?这是一个已知的错误?


编辑:附加信息......

在awakeFromNib中断,collectionView似乎无法访问

(lldb) …
Run Code Online (Sandbox Code Playgroud)

ios ios6 uicollectionview

6
推荐指数
1
解决办法
3553
查看次数