이미지를로드 할 수 없지만 지정한 경로에 있는지 확인합니다. 여기 UIImage가로드되지 않고 있지만 파일이 있습니다.
이미지로드하려고 코드입니다 :- (UIImage*) CPPlistImageToUIImage: (NSString *) CPPlistImage { /*TODO: Is this a memory leak? Find out*/ UIImage * ret = [UIImage imageNamed: CPPlistImage]; if(ret == nil){ RDLogString(@"Warning: Failed to load image: \"%@\"", CPPlistImage); } return ret; }
을 그리고 여기에이 기능이 보이는 디렉토리의 모든 파일을 나열하는 기능입니다 :
- (void) lsOwnDirectory { NSError * error = [[NSError alloc] init]; NSArray * files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath: pathToOwnDirectory error: &error]; for(NSString * file in files){ RDLogString(@"%@", file); } }
을 그리고 여기가 동일한 실행에서 두 기능의 출력 샘플 :
// CPPlist...Image telling he can't find/load the image 2009-11-29 02:12:51.510 CPPlayer[6452:207] CPConversation.m:113 Warning: Failed to load image: "/Users/nick/Library/Application Support/iPhone Simulator/User/Applications/D3403591-3A56-4F05-B4C1-C21DAAF918A2/CPPlayer.app/CP.Resources/CP.Conversations/Supermarkt/OIGNONS.png" ... // lsOwnDirectory is called AFTER CPPList...Image 2009-11-29 02:12:51.557 CPPlayer[6452:207] RootViewController.m:81 Contents of /Users/nick/Library/Application Support/iPhone Simulator/User/Applications/D3403591-3A56-4F05-B4C1-C21DAAF918A2/CPPlayer.app/CP.Resources/CP.Conversations/Supermarkt 2009-11-29 02:12:51.566 CPPlayer[6452:207] CPConversation.m:133 audio 2009-11-29 02:12:51.567 CPPlayer[6452:207] CPConversation.m:133 CPConversation.plist 2009-11-29 02:12:51.568 CPPlayer[6452:207] CPConversation.m:133 CPData.sqlite 2009-11-29 02:12:51.569 CPPlayer[6452:207] CPConversation.m:133 images 2009-11-29 02:12:51.570 CPPlayer[6452:207] CPConversation.m:133 OIGNONS.png
실마리가 없습니다. 왜 파일을 찾을 수 없습니까? 깜빡 : 하나 개의 기능은
어떤 도움을 크게, 사전에
감사합니다,
편집 닉 감사 ... 다른 하나는 그들이 같은 디렉토리에 보이는 것,하지 않는, 그것을보고 코드가 실행되고 iPhone OS 3.0 용 xcode로 컴파일된다는 것을 추가하십시오. 태그에서 가져온 것일 수도 있지만 여전히 있습니다.
감사합니다. 좋은 설명. :) – Nick
이것이 방금 내가 가지고있는 문제를 찾는데 도움이되었다고 언급 할만한 가치가 있습니다. 파일 이름만으로 이미지를로드했지만 특정 이미지가 표시되지 않고 메모리 주소가 0으로 설정되었습니다. 번들은 내 자산 폴더에서 이미지를 선택하고 파일 검사기 패널을 열었을 때 생각하고 있어요. . 물론 xcode는 내 이미지 몇 개만 대상 회원을 확인하지 않기로 결정했습니다. – Heckman
감사합니다. Heckman, 물론, 나는 똑같은 문제를 겪었습니다. 그리고 이것 또한 저의 속임수였습니다. – Ted