# \[Chapter 4\] Unable to run the sample code in the "Vertex Descriptors" Section

**URL:** <https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362>\
**Category:** Metal by Tutorials\
**Created:** [May 16, 2023, 3:56pm UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362 "2023-05-16T15:56:38Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 16, 2023, 3:56pm UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/1 "2023-05-16T15:56:38Z")

</div>

I copied the sample code from the chapter, but I can’t run it after compiling and it throws an error:  
**2023-05-16 23:39:01.594053+0800 Vertex[8589:409883] \*\*\* -[\_\_NSDictionaryM setObject:forKey:]: object cannot be nil (key: Remarks)**

At the same time, I also tried to use the final version project in github and got the same error

---

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 16, 2023, 4:09pm UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/2 "2023-05-16T16:09:17Z")

</div>

I tried to add some break point in the code and I find it couldn’t create the MTLRenderPipelineState object

---

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 16, 2023, 4:22pm UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/3 "2023-05-16T16:22:46Z")

</div>

It is hard to believe that I can run the code in iOS simulator, but I CANT run this code ON macOS. My computer is MBP 14’ M1 Pro.

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [May 17, 2023, 12:15am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/4 "2023-05-17T00:15:48Z")

</div>

That is odd. It runs on my M1 Mac mini and M1 MBP, and if it runs in Simulator, it ought to run in macOS. I’m making sure my M1 MBP is up-to-date and I’ll check it again there too after updating everything.

1. Is it only this chapter, or is it the same for all chapter sample codes?

2. What are your MBP specs? - OS version, Xcode version, RAM.

And welcome to the forums ☺!

---

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 17, 2023, 1:09am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/5 "2023-05-17T01:09:35Z")

</div>

Thanks for the reply. I tried to run sample code in later chapter and I **CANT** run them with same error(Some even have compilation errors).  
My system information is as follows and my Xcode version is 14.3

 ![image](https://files.chunter.kodeco.com/original/3X/1/c/1cc59f0e4cf4612265113457e938495aca7625b1.jpeg)

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [May 17, 2023, 1:09am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/6 "2023-05-17T01:09:42Z")

</div>

Another suggestion to try is cleaning everything, if you haven’t already tried that.

1. Go to Xcode Settings → Locations. Click on the arrow that takes you to the DerivedData directory.

 ![Screenshot 2023-05-17 at 11.06.26 am](https://files.chunter.kodeco.com/original/3X/4/7/47307f95bdd771ffc146ab7f3beea82f684a47bd.png)

Delete all the subdirectories in the DerivedData directory. These are old builds from all your apps.

1. Clean the project using cmd-shift-K.

2. Quit Xcode.

3. Restart your computer.

4. Try building and running the project again.

Edit: Just saw your post. Probably won’t work, but always worth trying :D. Especially rebooting.

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [May 17, 2023, 1:14am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/7 "2023-05-17T01:14:56Z")

</div>

What kind of compilation errors do you get?

You said this started with Chapter 4? Were you able to run Chapters 1 - 3?

---

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 17, 2023, 2:14am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/8 "2023-05-17T02:14:34Z")

</div>

I tried clean build and reboot first and it didn’t work 😭  
When I tried the sample of Chapter 6 before, there is a compile error and it disappeared after I cleaned the old build 😕  
And I am able to run Chapter 1-3 in playground

---

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 17, 2023, 2:51am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/9 "2023-05-17T02:51:27Z")

</div>

It becomes much more weird! I can run this sample on may i9 iMac but it dead on my M2 MBA with same error! 😭

---

<div class="post-metadata">

**Author:** ![geektaomarine](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@geektaomarine](https://forums.kodeco.com/u/geektaomarine)\
**Post date:** [May 17, 2023, 3:08am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/10 "2023-05-17T03:08:45Z")

</div>

Problem solved! The reason is I put this project in iCloud and it has some bug. When I move this project out it works. 😭

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [May 17, 2023, 3:37am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/11 "2023-05-17T03:37:27Z")

</div>

Oh I’m so happy! 😅 Thank you so much for reporting back.

I will have to remember to ask this - I think someone else had this problem too. I don’t know why it wouldn’t work. Perhaps local bits are disappearing occasionally.

---

<div class="post-metadata">

**Author:** ![robertomachorro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/robertomachorro/32/111603_2.png) [@robertomachorro](https://forums.kodeco.com/u/robertomachorro)\
**Post date:** [May 17, 2023, 11:54am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/12 "2023-05-17T11:54:22Z")

</div>

Just guessing it may have to do with the build folders?

---

<div class="post-metadata">

**Author:** ![tchelyzt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tchelyzt/32/111572_2.png) [@tchelyzt](https://forums.kodeco.com/u/tchelyzt)\
**Post date:** [May 23, 2023, 8:23pm UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/13 "2023-05-23T20:23:26Z")

</div>

Can I add my tuppence worth?  
Caroline you will remember our correspondence a few weeks ago concerning massive problems with my old 2015 machine.  
Well I’ve just received my new M2 Max machine, loaded Xcode and your tutorials and ran the first 10 chapters or so with recurrent problems. To take this chapter 4 as a simple example, it runs on Mac and in simulator, but the previews work only for iOS. When I try to preview for macOS, I get this:

 ![Screenshot 2023-05-23 at 21.15.47](https://files.chunter.kodeco.com/original/3X/b/7/b75e97055d0bf9d9212365f184ec2f40cdacc275.png)

The first few lines of the diagnostic report are:

> Incident Identifier: 4490D944-F436-4171-8521-44C6818D753F  
> CrashReporter Key: 7FE60CE1-FEC0-4D05-A0AC-4B3B52B0204D  
> Hardware Model: Mac14,6  
> Process: promotedcontentd [10336]  
> Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/libexec/promotedcontentd  
> Identifier: promotedcontentd  
> Version: ???  
> Code Type: ARM-64 (Native)  
> Role: Unspecified  
> Parent Process: launchd\_sim [10118]  
> Coalition: com.apple.CoreSimulator.SimDevice.188B917D-471F-4A7B-AD67-64F1424A8899 [13093]  
> Responsible Process: SimulatorTrampoline [3863]
> 
> Date/Time: 2023-05-23 17:24:36.2350 +0100  
> Launch Time: 2023-05-23 17:24:36.1700 +0100  
> OS Version: macOS 13.2.1 (22D68)  
> Release Type: User  
> Report Version: 104
> 
> Exception Type: EXC\_BREAKPOINT (SIGTRAP)  
> Exception Codes: 0x0000000000000001, 0x00000001a71fcfcc  
> Termination Reason: SIGNAL 5 Trace/BPT trap: 5  
> Terminating Process: exc handler [10336]
> 
> Triggered by Thread: 0
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

regards

---

<div class="post-metadata">

**Author:** ![caroline](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/caroline/32/111867_2.png) [@caroline](https://forums.kodeco.com/u/caroline)\
**Post date:** [May 24, 2023, 12:13am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/14 "2023-05-24T00:13:05Z")

</div>

Are your projects in iCloud?

---

<div class="post-metadata">

**Author:** ![tchelyzt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tchelyzt/32/111572_2.png) [@tchelyzt](https://forums.kodeco.com/u/tchelyzt)\
**Post date:** [May 24, 2023, 3:19am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/15 "2023-05-24T03:19:15Z")

</div>

No.  
So here’s what I’ve done. I built new projects, load your code file by file and _voila_, everything works.

My feeling is that every time Xcode gets any update from Apple, they mess about with some of the deep down parameters and cause all kinds of misery. There is so much going on at this specialist hidden level that I know nothing about.

My projects look different to yours. The distinction between iOS and macOS is much less evident, there’s no _shared_ folder and only a single target though it runs both iPhone and Mac apps.

The good news is that it works. The bad news is an overhead as I proceed through the book.

All the best

---

<div class="post-metadata">

**Author:** ![tured1966](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@tured1966](https://forums.kodeco.com/u/tured1966)\
**Post date:** [January 23, 2024, 10:43am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/16 "2024-01-23T10:43:04Z")

</div>

Thank you for sharing this[.](https://dgcustomerfirst.fun/).

---

<div class="post-metadata">

**Author:** ![intelefy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/intelefy/32/110373_2.png) [@intelefy](https://forums.kodeco.com/u/intelefy)\
**Post date:** [June 29, 2024, 11:35am UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/17 "2024-06-29T11:35:57Z")

</div>

Youtuber “GetIntoGameDev” does the odd Metal video. In one of which he advises to run Product → Clean Build Folder… (Xcode 15.3) whenever inexplicable build errors occur.

---

<div class="post-metadata">

**Author:** ![robertomachorro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/robertomachorro/32/111603_2.png) [@robertomachorro](https://forums.kodeco.com/u/robertomachorro)\
**Post date:** [June 29, 2024, 8:06pm UTC](https://forums.kodeco.com/t/chapter-4-unable-to-run-the-sample-code-in-the-vertex-descriptors-section/187362/18 "2024-06-29T20:06:34Z")

</div>

This applies to most Xcode projects lol

> Clean Build Folder when odd build issues happen.
