0

i don't understand what the issue seems to be with my app.

I can parse and output the json file, so that a specific label is populated with the name of the artist, the name of the album, as well as the id for the album.

My only issue is making the url appear in place of the label too.

I've double checked the documentation for lastfm, including the sample output, however it still doesn't show the url for a given album.

The code for this specific section is:

#import "MusicDetailsViewController.h"
#import "FilmSearchService.h"

@implementation MusicDetailsViewController

@synthesize imgAlbum;
@synthesize txtAlbumName;
@synthesize txtArtistName;
@synthesize urlOverview;
@synthesize txtUrl;
@synthesize movie;


-(void)viewWillAppear:(BOOL)animated {
    if ([self movie] != nil){
        [self setTitle:[[self movie] valueForKey:@"name"]];

        ;
        [txtAlbumName setText:[[self movie] valueForKey:@"name"]];

        [txtArtistName setText:[[[self movie] valueForKey:@"artist"] description]];


        [txtUrl setText:[[self movie] valueForKey:@"id"]];
          NSLog(@"value of url = %@", txtUrl);
         [urlOverview setText:[[self movie] valueForKey:@"url"]];

    }
}

@end

this is the error message I receive when doing that:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', 
 reason: '[<MusicDetailsViewController 0x71a84f0> setValue:forUndefinedKey:]:
 this class is not key value coding-compliant for the key txtUrllink.' *** 
Matthias Bauch
  • 89,811
  • 20
  • 225
  • 247
user1156596
  • 601
  • 1
  • 10
  • 29
  • Are you sure valueForKey@"id" is class of NSString. Can you add this log NSLog(@"%@", NSStringFromClass([[[self movie] valueForKey:@"id"] class])); and see is it NSString. – Greg Dec 10 '13 at 11:46
  • 1
    this is the error message i receive when doing that: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key txtUrllink.' *** First throw call stack – user1156596 Dec 10 '13 at 11:53
  • see this question: [This class is not key value coding-compliant for the key](http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for-the-key) – Matthias Bauch Dec 10 '13 at 11:54
  • 1
    **Always post the error message, that's the most important thing when you try to figure out an error. Your problem has nothing to do with the code you have posted.** You have renamed the IBOutlet `txtUrllink` to `txtUrl` in your code, without changing the connection in your xib/storyboard. Remove the invalid connection from your storyboard and connect the label to the correct outlet. – Matthias Bauch Dec 10 '13 at 11:57

2 Answers2

0

Since it is a label so you need to print like this below using text property, Please follow:-

 NSLog(@"value of url = %@", txtUrl.text);
Hussain Shabbir
  • 14,801
  • 5
  • 40
  • 56
0

Its just that your view controller has an IBOutlet named 'txtUrllink' which is no more linked.

nomann
  • 2,257
  • 2
  • 21
  • 24