URLWithString retourne nil

En cherchant à créer un NSURL à partir d’un fichier local, j’ai utilisé la méthode URLWithString de NSURL comme ceci :

URLWithString retournait nil… Le problème venait du chemin local qui contenait un espace, ce chemin était du type :

L’espace entre iPhone et Simulator n’était pas apprécié par URLWithString. Pour contourner le problème, il suffit de supprimer du chemin tous les caractères non-ASCII :

Source : http://stackoverflow.com/questions/1981390/urlwithstring-returns-nil

  • Trackback ( 0 )
  • Commentaires ( 0 )
  1. Aucun commentaire pour l'instant

  1. Aucun trackback pour l'instant