Search code examples
iosobjective-cnsurl

NSURL creation hangs


I am trying to create a NSURL for the file path : /private/var/mobile/Containers/Data/PluginKitPlugin/5EF4C1A8-D8F2-4867-B163-766C691A38C7/Documents/some_folder_name/data.mp4

String file_path = new File(documents_path + File.separator + some_folder_name + File.separator + "data.mp4").getAbsolutePath() 

The file path was created by getting the documents directory and manually appending the rest of the file path. It actually came from Objective C code generated using j2objc (basically java code).

Now, when I execute,

[NSURL fileURLWithPath: file_path]

, execution is stuck there. I was able to verify in xcode that when I pause, I am unable to come out of NSURL code.

Where am I going wrong here?


Solution

  • As you said you are manually appending paths. It’s better to use default methods of filemanager tocreate folder and append paths.

    After that final path should be added to NSUrl.