Closed lionhylra closed 8 years ago
Do you have the latest commit in place? There was a retain cycle that got fixed: 32ded5bf7bd3a0dbe2f719dbb6e8ef77c3a1d8ee
Thanks. I used the package on cocoaPods.
I'll put out an update for that soon, but for now you should be able to point Cocoapods to that commit. Thanks for filing!
I just use the latest commit and test it in the Instrument. The FBShimmeringLayer and FBShimmeringMaskLayer are still retained. Could you have a check?
When you say the instances increase when it is 'displayed', what do you mean by that? Are you asking it to start shimmering? Are you simply adding it to the view hierarchy? Creating a new FBShimmeringView
?
I would try limiting the operations you perform on the shimmering view, then go into the one operation that seems to cause the issue and find where it's allocating a new object.
I pushed another commit that might help. Let me know if that fixes it.
Please see my code below:
@interface LoginViewController()
@property (nonatomic, weak) IBOutlet FBShimmeringView * shimmerView;
@property (nonatomic, weak) IBOutlet UITextField * emailTextField;
@property (nonatomic, weak) IBOutlet UITextField * passwordTextField;
@property (nonatomic, weak) IBOutlet UIButton * loginButton;
@end
@implementation JLPLoginViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self showLogo];
}
-(void)showLogo{
UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.shimmerView.bounds];
imageView.image = [UIImage imageNamed:@"logo"];
imageView.contentMode = UIViewContentModeScaleAspectFit;
self.shimmerView.contentView = imageView;
// Start shimmering.
self.shimmerView.shimmering = YES;
}
@end
What I did is:
After trying the last commit, I find the issue is still there.
Unfortunately, you'll have to debug this yourself. It may be due to the specifics of how you're using Shimmer
.
I created a view(shimmerView) and added a FBShimmerView onto it. Then I make my app do this loop: Show the shimmerView, go to other views, go to shimmerView, go to other views...
Everything was normal except that something increased in the memory. So I opened Instrument to see what happened. And it showed that instances of FBShimmeringLayer and FBShimmeringMaskLayer increased by one every tine a FBShimmerView is displayed. That means when a FBShimmerView is deallocated, the FBShimmeringLayer is persisted in the memory.
See the screenshot below: