Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8410909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:18:08+00:00 2026-06-10T00:18:08+00:00

I have a function in my class: -(void)receiveFileName:(NSNotification *) notification { [self dismissViewControllerAnimated:YES completion:nil];

  • 0

I have a function in my class:

-(void)receiveFileName:(NSNotification *) notification {
[self dismissViewControllerAnimated:YES completion:nil];
NSString *selectedFileURL = [notification.userInfo valueForKey:@"selectedFile"];
NSString *fileName = [[selectedFileURL lastPathComponent] stringByDeletingPathExtension];
NSData *fileData = [NSData dataWithContentsOfFile:selectedFileURL];

}

It receives a file destination url from a table view controller and i need it to produce a fileName string and an NSData but i did some debugging and it gets caught on the NSData part and gives me this error:

-[NSURL getFileSystemRepresentation:maxLength:]: unrecognized selector sent to instance 0x1f507830

When i print the selectedFileURL i get

2012-08-14 21:58:01.309 Share Me[4546:907] file://localhost/var/mobile/Applications/B87D9131-2E73-4117-9EE8-32EA7E19127D/Documents/mza_9195653795305984944.320x480-75.jpg

And when i print the file name i get:

2012-08-14 21:58:01.309 Share Me[4546:907] mza_9195653795305984944.320x480-75.jpg

I tried using alloc and init but that didn’t solve the problem. Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T00:18:10+00:00Added an answer on June 10, 2026 at 12:18 am

    selectedFileURL is an NSURL instance, not an NSString – you probably misunderstood the docs of the framework/library you’re using. Quick solutions:

    NSData *fileData = [NSData dataWithContentsOfURL:selectedFileURL];
    
    NSData *fileData = [NSData dataWithContentsOfFile:[selectedFileURL path]];
    

    etc.

    Hint: you could already know that the object was not a string but an URL object as it started with file:// – that’s a special URL scheme for files; NSString instances containing a path don’t begin with this prefix, they’re of the plain form /path/to/file.ext.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function B that has this declaration: public void B(Class<? extends C>
Suppose I have a function defined like this: class Foo() { public: void bar(MyClass*
Let's assume we have a template function foo: template<class T> void foo(T arg) {
I have two functions in an ActionScript class, they are: private function loaderCompleteHandler(event:Event):void {
For example i have function declared in AS3.0 class: private function log():void{ // working
I have a delegate function class FuncActivator { public delegate void DelFunc(string arg, string
Let's say I have a class with the function class foo { ... void
I have this function in some library: class myConsole { void addCommand( std::string command,
I have a function in header file Class2.hpp of the form: class Class2{ void
I have a class: function RustEditor() { this.init = function() { var saveButton =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.