16

My friend came to me with a small request of creating a video portfolio app. I thought it was a good excuse to try out Swift, which is what I did. (The app is not intended for release on the app store, only to distribute via Testflight)

I've run into some trouble where I'm getting the following error when trying to run my project:

An error was encountered while running (Domain = NSPOSIXErrorDomain, Code = 22)

The error appeared after adding a directory with .mp4 video files to my project in my "Bundle Resources". It concerns 6 .mp4 files at around 1.2gb in total.

As I couldn't figure out why the error happened in the first place, I decided to re-do my entire project (copying over bits and pieces). The project ran just until the part where I added the folder containing the videos.

I've tried removing both the reference and the folder, but the error consist. I really want to get to the bottom of this, so that I instead of having to create a new project, I can just remove whatever files are creating the problem.

Thanks in advance.

dnlmzw
  • 751
  • 1
  • 8
  • 20

5 Answers5

95

In my case, I had created the directory "Resources" absentmindedly and added it as a reference to my project. Renaming this folder, cleaning the project, and deleting the derived data (~/Library/Developer/Xcode/DerivedData/) fixed it for me.

Mike Sprague
  • 3,567
  • 1
  • 22
  • 25
  • 1
    Not exactly my problem, but it was related to how precious Xcode treats the Resources folder. Thanks! – rob5408 Feb 03 '15 at 05:22
  • 6
    Thanks! For me simply deleting the `~/Library/Developer/Xcode/DerivedData` directory worked. – alexpls Dec 09 '15 at 09:02
  • 5
    You can also delete them through XCode, Open Window -> Projects -> YOUR_PROJECT -> Delete DerivedData – Ardavan Kalhori May 15 '16 at 23:11
  • After 2 hours found solution – Bernard Aug 14 '16 at 09:24
  • 3
    I had a folder named "Resources" added in Xcode as reference (blue folder). I removed the folder reference and included the files directly by creating a group (yellow folder) with _same name_, and it worked. – Sabir Ali Aug 18 '16 at 13:12
  • Resources can also be the directory name in a development pod you're working on. It can show up inside a .bundle from that pod. Rename it in your source to something like Assets, delete derived, clean, delete pods directory, install pod. – Will Larche Oct 26 '16 at 14:53
  • I also think the Resources folder was the issue! I was working from open source code that was originally Objective C and ran in previous Xcode version! – earlonrails Oct 17 '17 at 03:00
  • is there a reason why the Resources folder must be a group, not a folder reference? – bze12 Oct 17 '21 at 04:30
4

Check infoplist file under TARGETS -> General - > Identity.

Please add the new infoplist file if missing in project folder. For new info plist values you can create new dummy project and copy, rename the infoplist file from there.

1

Maybe the files with the extension ".m" are not in "Compile Sources". Click in the Target > Build Phrases > Compile Source and look if "main.m" and others ".m" files are added here.

orafaelreis
  • 2,855
  • 2
  • 28
  • 31
1

in my case, i missed the bundle ID. check if you have filled the bundle ID field in your project.

Aqeel iqbal
  • 515
  • 5
  • 18
0

(In my case ,it is becasue cloud_firestore) Did you import cloud_firestore? if yes ,please Try low version

Kevin
  • 303
  • 3
  • 9