2012-10-06 5 views
0

나는 다른 사람에 의해 쓰여진 몇 가지 코드를 유지하고 내가 엑스 코드 4.5에 구축하고 실행하면 아이폰 OS 6에 나는이 실행시 "오류"를 얻을함수 'CGCMSUtilsGetICCProfileDataWithRenderingIntent'는 더 이상 사용되지 않습니다. 이 솔루션은 왜 작동합니까?

<Error>: The function `CGCMSUtilsGetICCProfileDataWithRenderingIntent' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance. Please use `CGColorSpaceCopyICCProfile' instead. 

이 코드를 실행 :

CGColorSpaceRef alternate = CGColorSpaceCreateDeviceRGB();    
NSString *iccProfilePath = [[NSBundle mainBundle] pathForResource:@"sRGB Profile" ofType:@"icc"]; 
NSData *iccProfileData = [NSData dataWithContentsOfFile:iccProfilePath]; 
CGDataProviderRef iccProfile = CGDataProviderCreateWithCFData((CFDataRef)iccProfileData); 

const CGFloat range[] = {0,1,0,1,0,1}; // min/max of the three components 
CGColorSpaceRef colorSpace = CGColorSpaceCreateICCBased(3, range, iccProfile, alternate); 

CGContextRef context = CGBitmapContextCreate(NULL, pageWidth, pageHeight, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); 

CGDataProviderRelease(iccProfile); 

CGColorSpaceRelease(colorSpace); 
CGColorSpaceRelease(alternate); 

을 iOS 5.1에서 실행할 때 오류가 없습니다.

나는 다음을 것이 변경하여 오류가 나타나지 않는 것으로 나타났습니다 :

변경 :

NSString *iccProfilePath = [[NSBundle mainBundle] pathForResource:@"sRGB Profile" ofType:@"icc"]; 
NSData *iccProfileData = [NSData dataWithContentsOfFile:iccProfilePath]; 
CGDataProviderRef iccProfile = CGDataProviderCreateWithCFData((CFDataRef)iccProfileData); 

에 :

char fname[]= "sRGB Profile.icc"; 
CGDataProviderRef iccProfile = CGDataProviderCreateWithFilename(fname); 

내가 에 대한 참조를 찾을 수 없습니다 CGDataProviderCreateWithCFData은 더 이상 사용되지 않습니다. 누구든지 문제의 원인을 설명 할 수 있습니까? CGDataProviderCreateWithCFData가 CGDataProviderCreateWithFilename이 CGDataProviderCreateWithCFData이되지 않습니다 나에게 제안 CGColorSpaceCopyICCProfile을 사용 CGCMSUtilsGetICCProfileDataWithRenderingIntent을 사용 처럼 보인다. 나는 이것을 이해하지 못하기 때문에 내가 찾은 해결책에 만족하지 못한다. 또한이 솔루션이 누군가를 돕기를 바랍니다.

+0

좋아요, 나는 그것이 "작동"하는 이유, 즉 오류를 생성하지 않는 한 가지 이유를 발견했습니다. 두 번째 버전에서는 iccProfile이 nil입니다! 더 조사 할게요 –

+0

오케이, 미안 해요. 이걸 잊어 버려. CGDataProviderCreateWithFilename에는 전체 경로가 필요하며 iccProfile은 nil이므로 오류가 사라졌습니다. 전체 경로를 사용하면 문제가 사라지지 않았 음을 알 수 있습니다. –

답변

1

그래서 sRGB 색상 프로파일 파일을 앱 리소스에 첨부하고 iOS의 런타임에 sRGB 색상 프로파일을 명시 적으로 생성합니다. 그게 필요한가요? 우리가 부를 수있는 경우

Apple WWDC color management talk

그것은 좋은 것 :이 문서는 장치 RGB 실제로의 sRGB 색 공간 인 것을 제안 보인다

colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); 

을하지만이에 지원하지 않는 것 iOS 중 하나.

관련 문제