自昨天升级到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) 使用ASIFormDataRequest将文件上传到服务器时非常奇怪(对我而言).
通过WiFi上传时,没有问题,我可以上传就好了.使用O2 UK作为运营商通过3G上传时,也没有问题.当我使用完全相同的代码使用Vodafone UK上传相同的服务器时,HTTP请求到达服务器并且POST内容被剥离.如果我尝试相同的请求但没有上传图像(只需添加test => yes作为一些POST数据),那么这将有效,但是如果我有test => yes并附加一个文件,它会通过POST到达服务器数据被剥离了.
NB我在iPhone 4S上使用最新版本的ASIHTTPRequest,并且可以在使用Vodafone UK和O2 UK的其他几款手机上进行各种再现.
所以,我将我的objc代码指向以下PHP脚本,它只打印出它收到的内容:
<?php
error_reporting(E_ALL);
ini_set("display_startup_errors","1");
ini_set("display_errors","1");
echo "FILES: ".print_r($_FILES,true);
echo "POST: ".print_r($_POST,true);
echo "GET: ".print_r($_GET,true);
die('done.');
Run Code Online (Sandbox Code Playgroud)
我正在使用的obj-c代码是:
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *url = [NSURL URLWithString: @"http://myserver.com/debugger.php"];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setDelegate:self];
[request setDidFinishSelector:@selector(networkRequestSuccess:)];
[request setDidFailSelector:@selector(networkRequestFailure:)];
[request setTimeOutSeconds:120];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"smalltestimage" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:filePath];
if (myData) {
[request addPostValue:@"Yes" forKey:@"Test"];
[request addData:myData withFileName:@"smalltestimage.png" andContentType:@"image/png" forKey:@"photos"];
[request startSynchronous];
}
else{ …Run Code Online (Sandbox Code Playgroud)