Questions tagged [optional-values]

79 questions
2
votes
2 answers

Unexpectedly found nil while unwrapping an Optional value when passing data backward

I have learned Swift and Xcode for about 3 weeks and I am doing an Todo App just for practice. But when I was trying to add new item to my todo list the error occurred saying that "Unexpectedly found nil while unwrapping an Optional value". I have…
Bad Son
  • 131
  • 2
  • 16
2
votes
0 answers

Redux/typescript selectors for optional values best practices?

So I have a key in my redux state roomId that is only undefined for a short amount of time. After that it will always be defined. Now the problem is that my state looks like this: interface State { roomId?: string; } And my selector export const…
Totty.js
  • 15,563
  • 31
  • 103
  • 175
2
votes
2 answers

Swift flatMap: How to remove only tuples from an array where specific element in the tuple is nil?

I have an array of tuples where the tuple contains some optional values: let arrayOfTuples: [(Int, String?, String?)] = ... How can I best remove from the array those tuples where the second element of the tuple is nil (no matter if the 3rd element…
Super Geroy
  • 123
  • 1
  • 10
2
votes
2 answers

MailComposeViewController Error: unexpectedly found nil

I'm trying to save the email and time of an email i sent, to a table view. The emails send fine, but I get this error (Error: unexpectedly found nil while unwrapping an Optional value) whenever I click the send button. I'm not sure where is the…
Nyxx
  • 303
  • 3
  • 13
2
votes
2 answers

Confused about optional value in swift

I'm new to swift and I don't really understand how to use optional value correctly. The situation is: Firstly, I have a model class to store some values of its properties and send the request to server to get values. code: import Foundation class…
Hongxu Jin
  • 817
  • 2
  • 9
  • 16
2
votes
1 answer

simple image data passing from collection view to view controller fail

This is seriously starting to drive me crazy, since it s really simple. I have a collectionviewcell that gets images from phone library When i tap a cell, i get the index of the fetched collection (i m using Photo Framework), then send the selected…
Yann Massard
  • 283
  • 2
  • 16
2
votes
2 answers

How do I evaluate "&optional argument" in emacs lisp?

I dont understand how to evaluate "&optional argument" in emacs lisp. My code is: (defun test-values (a &optional b) "Function with an optional argument (default value: 56) that issues a message indicating whether the argument, expected to be…
2
votes
3 answers

fatal error: unexpectedly found nil while unwrapping an Optional value(When adding to a array)

I have some code that receives value from a segue and replaces a certain element of an array with the index number that I have. The initialization of the variables is: var noteTitles: [String] = ["Sample Note"] var noteBodies: [String] = ["This is…
SentientBacon
  • 1,509
  • 3
  • 11
  • 19
2
votes
1 answer

fetchedResultsController core data fatal error: unexpectedly found nil while unwrapping an Optional value

I know there are innumerable questions with the same error but none of the solutions seemed to work. I want to make a blog reader app that saves and fetches data from the CoreData. I am able to save the JSON results into the CoreData, but when i try…
Swapna Lekshmanan
  • 514
  • 10
  • 30
1
vote
2 answers

How to select random values from the list?

from random import Random from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from…
Carl Carl
  • 27
  • 6
1
vote
1 answer

Do select and checkboxes values, in HTML forms, support non latin characters?

I have the following code in a web form: