programing

장치에서 실행중인 번들의 펜촉에서 참조 된 이미지를로드 할 수 없습니다.

nasanasas 2020. 11. 22. 19:50
반응형

장치에서 실행중인 번들의 펜촉에서 참조 된 이미지를로드 할 수 없습니다.


SplitView [1290 : 307] 식별자가 "xx.co.mycompany.ipad.SplitView"인 번들의 펜촉에서 참조 된 "canary04.png"이미지를로드 할 수 없습니다.

장치에서 실행할 때만 오류가 발생합니다. 시뮬레이터에서 실행하는 데 문제가 없습니다.

UIImageView와 함께 인터페이스 빌더에서 직접 이미지를 사용하고 있습니다.

편집 : 다른 펜촉에 다른 새 이미지를 추가했는데 문제가 없습니다.

누구나 아이디어가 있습니까?


iOS 기기의 파일 시스템은 대소 문자를 구분하므로 케이스 문제 일 수 있습니다. (Mac OS X는 일반적으로 대소 문자를 구분하지 않으므로 시뮬레이터에서이 문제를 보지 못했습니다.)

따라서 코드에서 파일 이름 자체와 동일한 대소 문자를 사용하고 있는지 확인하십시오.


Target에 추가되지 않을 수 있으며 XCode 4에서는 다음과 같이 할 수 있습니다.

  • 프로젝트보기에서 프로젝트 이름을 클릭하십시오.
  • 대상을 선택하고 "Build Phases"탭을 선택합니다.
  • 이미지 파일을 "번들 리소스 복사"섹션으로 드래그하십시오.

그것은 나를 위해 그것을 고쳤습니다.


XCode의 참조 폴더 (파란색 폴더)에 이미지가 있습니까? 그렇다면 이미지 경로에 "Images / canary04.png"와 같은 폴더 이름을 포함해야합니다.


쉬운 방법

1참조 된 이미지의 문자열을 찾으려면 명령 셸에서 grep수행하면 됩니다.

grep -R 'canary04.png' YourMainDirectoryFolder/*

2 예를 들어 다음과 같은 출력을 제공합니다.

YourProject/en.lproj/YourViewController.xib: 

<textField borderStyle="roundedRect" background="canary04.png" id="19">

3이제 어떤 nib 파일과 어떤 요소인지 알 수 있습니다. 파일로 이동하여 참조를 제거하십시오.


  1. 이미지가있는 파란색 폴더를 삭제합니다.
  2. 다시 가져오고 "필요한 경우 항목 복사"를 선택합니다.
  3. 폴더가 아닌 "그룹 만들기"를 선택합니다.

이미지를 PNG-24로 저장합니다. 그것은 나를 위해 작동합니다


이 작업을 수행하여 스토리 보드 또는 펜촉에서 확인할 수 있습니다. 소스 코드로 열기 :

여기에 이미지 설명 입력

그런 다음 그 안에있는 이미지 이름을 "찾아", 존재하지만 프로젝트에서 이미 유효하지 않은지 확인합니다. 아마도 이름을 삭제하거나 변경했는데 이제 유효하지 않은 것 같습니다.

여기에 이미지 설명 입력


대상에 파일을 포함 시켰습니까? Xcode에서 Target을 마우스 오른쪽 버튼으로 클릭하고 Get Info를 선택한 다음 상단에있는 "Targets"그룹을 선택합니다. 의도 한 타겟이 확인되었는지 확인하십시오.

행운을 빕니다.

편집 : 위의 텍스트는 Xcocde 에서 파일 (canary04.png)마우스 오른쪽 버튼으로 클릭하고 정보 가져 오기를 선택해야합니다.

오타로 죄송합니다.


Xcode 4.4.1로 업그레이드 할 때이 문제가 발생했습니다. 스토리 보드에서 이미지 (및 해당 버튼 등)를 삭제했지만 내 스토리 보드 파일 (tabBarItems 필드)에 여전히 언급이 있음을 발견했습니다. 수동으로 주석 처리 (), Product-> Clean, 더 이상 오류가 발생하지 않았습니다.

이전에 TabBar를 삭제했고 현재 앱이 콘솔의 성가신 메시지와 함께 문제없이 작동했기 때문에 스토리 보드에 가짜 참조가 있어야한다는 것을 알았습니다.


나는 같은 문제가 있었다. 하려고 노력하다

  • 깨끗한
  • 빌드 및 실행

그것은 나와 함께 일했다


제 경우에는 Photoshop이 내 파일을 올바르게 저장하지 않았기 때문입니다. 파일 저장 대화 상자에서 해당 파일을 덮어 쓰려고 myfile.png를 클릭했는데 png 확장자로 파일을 저장했지만 포토샵 형식으로 저장했습니다.

덮어 쓰고 싶은 파일을 클릭하기 전에 실제로 파일 형식을 PNG로 변경해야했기 때문에 실제 png 파일로 저장하여 iOS에서 읽을 수 있습니다. 흥미롭게도 인터페이스 빌더는 내 psd-as-png 파일을 잘 보여주었습니다.

더 일반적으로 파일이 실제로 생각하는 형식이고 iOS가 예상하는 형식인지 확인하십시오.


해결 방법 1 :

제 경우에는 이미지가 포함 된 폴더를 복사하고 "대상 : 필요한 경우 항목 복사"선택했습니다 . 그러나 "빌드 단계"의 "번들 리소스 복사"에는 추가되지 않았습니다.

다음과 같이 이미지를 추가 할 수 있습니다.

  1. 대상 선택
  2. "Build Phases" 탭을 선택합니다.
  3. 선택 "복사 번들 리소스 "
  4. 바로 아래 에있는 "+" (플러스) 버튼을 클릭합니다.
  5. 이미지를 찾아 추가

솔루션 1 스크린 샷

솔루션 2 :

"스 래시로 이동"을 선택하여 이미지삭제합니다 . 다시 "대상 : 필요한 경우 항목 복사"를 선택하여 프로젝트 에 이미지추가 합니다.

Note : Make sure that you add images in Assets.xcassets folder and not outside it.

이 오류도 발생했습니다. 내 시나리오를 설명하겠습니다.

거기에 png가있는 하위 디렉토리 "img"가 있습니다.
이 png 중 하나는 "ic_timeprogress_000.png"입니다.

스토리 보드 (비주얼 디자이너)에는 imageView가 있고 이미지는 "ic_timeprogress_000.png"(프로그래밍 방식이 아님)로 설정되었습니다. 디자이너는 imageView를 올바르게 표시했습니다.

하위 디렉토리의 imageView

앱을 실행할 때 오류가 발생했습니다.

So in the storyboard I changed (I insist: not programatically) from "ic_timeprogress_000.png" to "img/ic_timeprogress_000.png", which lead to not showing correctly the image in the designer but showing correctly when running (no error)

하위 디렉토리의 imageView

Although I alter imageView.image programatically, so this "initial image" isn't ever used.


Check to make sure that canary04.png exists in your project, and that it was not deleted.


My problem was that I saved the image as .jpg and changed the name to .png (was still in jpg format). It worked with simulator


Check your image name. If it contains some spaces then image will show while running in simulator but not in the device. While running it checks Case sensitive name etc.


I had a different problem in iOS 8. In my case the problem was that I selected Device Specific for the image set, and then selected iPad. Changing this back to Universal fixed the problem.

This setting can be found in the images.xcassets file, in the third column show the attributes inspector for the image set.

In this case the images wont be displayed in the storyboard or NIB file even if you have added them to images.xcassets. They also wont show in the simulator or device.


I've encountered this issue when I was trying to set image of an imageView on Interface Builder (.xib) file.

(I was using Image Assets)

I've had 2 images with theImage.jpeg and theImage@2x.jpg Interface Builder could be able to display true images at compile time with these jpg / jpeg formats. But I've got this error in the runtime:

Could not load the "theImage" image referenced from a nib in the bundle with identifier "org.etc.etc"

Then I changed my image files formats to .png and it worked!

Try this solution too if you have different formats for images you try to set.


I also met the problem that jpeg files cannot be loaded successfully, however I solved it without changing them to png format: for example, if you have an image named "bg.jpg", don't use "bg" in storyboard (this name is listed in the dropdown selection list), instead you should explicitly write "bg.jpg" in the name field.

For programming based image view, I guess using .jpg extension like [UIImage imageNamed:@"xx.jpg"] should also work (I did't test though).


Try cleaning the project and make sure the info.plist matches the xx.co.mycompany.ipad.SplitView


Check the image name. Then check to see if you can open the image itself in paint or photoshop. If the image was created in photoshop and there were layers sometimes there is some conflict with the .png


I had the same issue, if your images are inside sub-folders, you need to choose "Create groups for subfolders" Option when you copy the resources.


I have this problem with Xcode 5, and it seems "Combine high resolution artwork" is the culprit. I opened the app bundle, and all the images were *.tiff, which caused the image to "not be found" :S

FIX:

Open project settings, and search in the top for "combine". Change that setting to NO.

여기에 이미지 설명 입력

For some reason, everyone is missing this essential fix.


In my case all images where displaying fine on devices with >iOS 7 but not with iOS 6.1. The solution was that iOS7 is case sensitive but iOS 6.1 wasn't for me. I had images named like "myImageName" and also named "myimagename" witch leads my old iPhone 3 to be unable to display these images.
So renaming them solved it.


Tried each and every answer here and nothing, so here's another glitch, your icon name cannot have dots (.) because if it does (and Xcode allows you to do that!) while the icons show well in storyboard, they won't load either in the simulator or the device.


Maybe after you set the button's image, you changed the image's name.


2015 - Still having this problem. I was referencing an image that no longer existed in one of tabbed buttons.

Solution: Simply inspect all your buttons, UIImage etc. and make sure that the image that you are referencing actually exists within your project.


I got this problem when I accidentally added another Image set to Asset Catalog file. I renamed it after I realised the mistake, but it doesn't seem to work.

Removing the file and adding it again solves the problem.


what worked for me is making sure the file's owner in interface builder has a "view" outlet.

From IB, select file's owner from "Placeholders", then in "Connections Inspector" make sure the view outlet in connected to the main view of current XIB.

This happened because i removed the main view at some point and forgot to reconnect my new view.

Hope it helps somebody else.


제 경우에는 이미지 형식이 문제였습니다. 그들은 'jpg'파일이었고 Xcode는 'png'파일을 예상했습니다. 파일 형식을 변경하면 문제가 해결되었습니다.

참고 URL : https://stackoverflow.com/questions/4853808/could-not-load-the-image-referenced-from-a-nib-in-the-bundle-running-on-device

반응형