Computer Science/swift 뽀개기 - 참고 사이트 저장소

[swift] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' 해결방법 포함!

_cactus 2025. 4. 7. 19:38
반응형

홈화면 위젯을 개발하던 도중 위젯을 누르면 자꾸 해당 에러가 뜨면서 앱이 terminate됐다

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'

 

해결방법은 생각보다 아주 간단했다..

 

위젯화면 swift 코드에서 widgetURL을 안 넣어줘서 그랬던것..!

 

 

물론 info.plist에 URL scheme도 설정해줘야한다

<key>CFBundleURLTypes</key>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>myapp</string>
        </array>
    </dict>
728x90
반응형