我尝试接收图像,解码并保存在Documents文件中,但在修改Uikit对不同版本的Iphone的限制后,我遇到了与Core Services库和Uikit兼容的问题。我还有其他问题:
gcc-4.2因退出代码1 iphone
而失败右键单击错误行并选择“打开这些最新结果作为转录文本文件”:
Build WSStub of project WSStub with configuration Debug
Ld build/Debug/WSStub normal i386
cd /Users/********/Desktop/WSStub
setenv MACOSX_DEPLOYMENT_TARGET 10.5
/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -L/Users/********/Desktop/WSStub/build/Debug -F/Users/********/Desktop/WSStub/build/Debug -F/Users/********/Desktop/WSStub -filelist /Users/********/Desktop/WSStub/build/WSStub.build/Debug/WSStub.build/Objects-normal/i386/WSStub.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework CoreServices -framework UIKit -framework CoreGraphics -o /Users/********/Desktop/WSStub/build/Debug/WSStub
ld: warning: in /Users/********/Desktop/WSStub/UIKit.framework/UIKit, missing required architecture i386 in file
ld: warning: in /Users/********/Desktop/WSStub/CoreGraphics.framework/CoreGraphics, missing required architecture i386 in file
ld: duplicate symbol _UIEdgeInsetsMake in /Users/********/Desktop/WSStub/build/WSStub.build/Debug/WSStub.build/Objects-normal/i386/main.o and /Users/********/Desktop/WSStub/build/WSStub.build/Debug/WSStub.build/Objects-normal/i386/EnvioImagen.o
collect2: ld returned 1 exit status
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
我无法解决这个问题.....
的main.m
...
Envio * envio = [[Envio alloc] init];
[envio setMethod:method];
NSDictionary * imagen = [[NSDictionary alloc] initWithDictionary:[envio resultValue]];
NSString *im = [[NSString alloc] initWithString: [imagen valueForKey:@"return"]];
NSData * imagenDecode = [envio base64DataFromString:im];
[envio save:imagenDecode];
...
EnvioImagen.m
#import "EnvioImagen.h"
@implementation Envio
- (void) setMethod:(NSString*)myMethod
{...}
- (void) setInvocation:(NSString*)invoc
{...}
- (void) setSoap:(NSString*)mySoap
{...}
- (void) setNameSpace:(NSString*)myNamespace
{...}
- (NSDictionary*) resultValue
{...}
- (WSMethodInvocationRef) genCreateInvocationRef
{...}
+ (NSData *)base64DataFromString: (NSString *)string
{.....}
+ (void)save: (NSData *)data
{
UIImage *im = [[UIImage alloc]initWithData:data];
NSData *datai = UIImagePNGRepresentation(im);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *directory = [paths objectAtIndex:0];
NSString *fullPath = [directory stringByAppendingPathComponent:@"david.png"];
[fileManager createFileAtPath:fullPath contents:datai attributes:nil];
}
@end;
@implementation EnvioImagen
+ (id) Envio:(CFTypeRef) parameters
{
id result = NULL;
Envio* invocation = [[Envio alloc] init];
result = [[invocation resultValue] retain];
[invocation release];
return result;
}
@end
答案 0 :(得分:0)
您已将SDK设置为Mac OS X SDK之一,而非iPhone SDK。 Mac OS X没有UIKit。
答案 1 :(得分:0)
好像你把架构搞砸了。因此编译器认为它正在为Mac OS而不是iOS编译。检查构建设置和/或重新生成方案(产品 - >管理方案 - >自动生成)。