0

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...

igpogo
  • 16
  • 4

3 Answers3

0

Make sure you have / your image is set in Copy Bundle Resources. You can check if your image path is valid also. But I think the image is not set to copy at Build Phases.

ares777
  • 3,590
  • 1
  • 22
  • 23
  • The images are located in Documents directory.The image to show is a picture took by the user. The user performs several tasks over it. Then I use the that picture, and all the image processing are correctly done. I can not do that at Build Phase. Thanks for your answer. – igpogo Mar 26 '15 at 16:42
  • please check method for localpath. Also NSLog all paths and filenaames (include directories). I think there must be a difference between app deployed via testflight and app running on device via XCode. Post those logs. – ares777 Mar 26 '15 at 18:03
  • It seems the problem it is connected with auto layout. I couldn't figured out why only happens on app loaded through itunes or testflight. The frame size on the UIImageView gets set to (0,0,0,0). it is very frustrating to work only in the device through archive--> export --> itunes... – igpogo Mar 26 '15 at 23:28
0

I had the same problem.. Haven't find a correct solution.

But I deleted the image(check if it's deleted in ur Bundle resources), then put the image again, with ANOTHER name. It worked for me. It's a temporary solution, idk if it's an apple bug or what.

Leonardo Cavalcante
  • 1,274
  • 1
  • 16
  • 26
0

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.

igpogo
  • 16
  • 4