문제

I call this function in my viewDidLoad

- (void)addRefreshControl { 
    refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:NSLocalizedString(@"Pull to refresh", nil)]];
    [refreshControl addTarget:self
                       action:@selector(refreshView)
             forControlEvents:UIControlEventValueChanged];

    [self setRefreshControl:refreshControl];
}

Nearly everytime I pull to refresh I'm getting warned with this message in the debugger CUICatalog: Invalid asset name supplied: (null), or invalid scale factor: 2.000000

It's not interrupting my app, however, I would like to understand where this message comes from and avoid it.

도움이 되었습니까?

해결책 2

So basically this had nothing to do with the refreshcontrol but with the image name used while init'ing the image. I used to do this:

[UIImage imageNamed:[someDictionary objectForKey:@"imageKey"]];

But what I really needed to do is this:

[UIImage imageNamed:[NSString stringWithFormat:@"%@",[someDictionary objectForKey:@"imageKey"]]];

So by turning it into an NSString, the error isn't produced anymore. Sure you need to have a @2x paired image, but even if you have those, without NSString'ing the name, you'll still get this error.

다른 팁

Check if you have the paired @2x image.

If you are with storyboard, also check if the image has the name in the image field.

Just happened to me that the image was in the storyboard but the name in the field was cleared.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top