开发者

Different behavior of app while testing on device and simulator?

开发者 https://www.devze.com 2023-04-01 11:39 出处:网络
I m working on an app in which i have 5 buttons(having .png images included in resources) m hiding them in viewDidload and showi开发者_如何学JAVAng them after choosing the image from UIImagepickerView

I m working on an app in which i have 5 buttons(having .png images included in resources) m hiding them in viewDidload and showi开发者_如何学JAVAng them after choosing the image from UIImagepickerView.

All is going well in simulator but when i launch the app on device i cant find those buttons.

anyone have any idea of this situation?????

here is the code of my hiding and showing the buttons.

- (void)viewDidLoad {
[super viewDidLoad];

self.count1 = 1;

btnAddPimple.hidden = YES;
btnAddPimple2.hidden = YES;
btnAddPimple3.hidden = YES;
btnAddPimple4.hidden = YES;
btnAddPimple5.hidden = YES;

self.navigationController.navigationBar.hidden=YES;

Here I am showing the buttons after choosing image from Imagepicker.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {


imgToDisplayFromPicker.image = [[info objectForKey:UIImagePickerControllerOriginalImage]retain];
[[picker parentViewController]dismissModalViewControllerAnimated:YES];
[picker release];   



btnAddPimple.hidden = NO;
btnAddPimple2.hidden = NO;
btnAddPimple3.hidden = NO;
btnAddPimple4.hidden = NO;
btnAddPimple5.hidden = NO;


for (UIView *subview in [self.view subviews]) {
    // Only remove the subviews with tag not equal to 1
    if (subview.tag != 0) 
    {
        [subview removeFromSuperview];
    }
}
}


A big difference between the simulator and an actual device is that Mac OS (thus, also the simulator) is case insensitive, while the device is not. The images are most probably not showing because you did not type them with the correct capitalization.

If you are sure that is not the problem, it would help to see your code.


it may be the problem with images , for testing try with only buttons (roundrect) and try in device without images. and if it work fine then there may be problem with images.


Can you please debug it on device if you know about it then it would be very easy to trace out the crase where it is crasing. As @antalkerekes said, if there is no issues regarding the case sensitivity then the app should work, but for your know do device testing.


Have the same behavior: UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; returns nothing (0x0) on iOS5.0 simulator, so buttons show up empty and, in this case, it has nothing to do with spelling/caps/lowercase etc. On the device everything is fine though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号