objective-cuiimageviewautolayoutxcode-6.2ios8.2

iOS 8.2 upgrade not show image in UIImageView, but only in app loaded through iTunes or TestFlight not Xcode


As weird as it sounds...

App loaded through test flight or iTunes does not show image on the screen, but it does when it is loaded through Xcode. I believe the UIImageView is there, and the UIImage is loaded.

App loaded through the Xcode works.

If the device is connected to the Xcode and debugging, device connected with USB cable. App works despite the load method...

Core data seems to works in all cases.

Any idea, somebody has seen something similar. I am quite lost.

Also if you have any tip on how to debug this on the device I will appreciate it.

The few code I think it is involve.

I am loading the UIImage from disk using

UIImage * previewImage = [UIImage imageWithContentsOfFile:path];

The image is located in Documents Directory fileName is the input

NSURL *documentsFolderURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSString *documentsFolderPath = [documentsFolderURL path];

if (![_documentsDirectory isEqualToString:documentsFolderPath]) [self generateLocaFolderPath];

NSString *returnedPath = [_documentsDirectory stringByAppendingPathComponent:fileName];

return returnedPath;

and setting the image in the imageView with

previewView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0,  frameImageThumbnail.size.width, frameImageThumbnail.size.height)];
[previewView setImage:previewImage];

Everything else seems to work well...

My first question!!! Thanks for reading!

_ edit _

I had the strong believe now that the problem is not in the UIImage, I have use the same methods in other parts of the app and it is working fine.

But now I believe the problem is in the animation I perform to the UIView that contains the UIImageView.

[_view setFrame:frameImageThumbnail];
[_view setClipsToBounds:YES];
[_view setAutoresizesSubviews:YES];
[_image setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
[_view addSubview:_image];

[UIView animateWithDuration:0.4
                      delay:0.1
                    options:UIViewAnimationOptionCurveEaseInOut
                 animations:^(void){
                     CGRect destination1Frame = _view.frame;

                     //... some complicated calculations with the rect ... 

                     [_view setFrame:destination1Frame];

                     [UIView transitionFromView:_customView toView:_view duration:0 options: UIViewAnimationOptionShowHideTransitionViews completion:^(BOOL finisehdCompletion){
                          //stop showing video in _customView    
   }]; 
}];

I am using NSAutolayout in the storyboard. Though my application only allows one landscape orientation. No idea if all this meshing up with the frames it is making. dizzy to the poor auto layout guy...


Solution

  • Ok After more than 20 ipa files build and installed in my devices. In all this process to get rid of the problem I removed the _view from the storyboard, and initiallize the view programmatically. I remember that _view was originally set to (weak, nonatomic) property because was made with the storyboard, this super nice ctrl+.

    That was I change I made, weak to Strong, and works now.

    I don't know why it didn't work only when the program was install through iTunes with the ipa file or through the test flight app. That is still a mystery to me.