[TIMOB-3362] iOS: showCamera does not work on iPad2 if running iPad app
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Low | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2011-05-11T14:46:40.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | Release 1.7.0, Sprint 2011-12 | 
| Components | iOS | 
| Labels | defect, ios, ipad2, klist, release-1.7.0, reported-1.6.1, rplist | 
| Reporter | Jon Alter | 
| Assignee | Reggie Seagraves | 
| Created | 2011-04-15T03:43:15.000+0000 | 
| Updated | 2011-05-11T14:46:40.000+0000 | 
Description
If you run an iPad application on the iPad
Titanium.Media.showCamera doesn't work.
If you run an iPhone application on the iPad,
Titanium.Media.showCamera camera works properly.
-fail with iPad app Step 1: make an app for 'iPad' and paste in
the code below.
step 2: run the app on an iPad 2
Step 3: click the 'camera' button
Step 4: notice the camera overlay fly out the top of the page
-pass with iPhone app Step 1: make an application for 'iPhone'
and paste in the code below
step 2: run the app on an iPad 2
Step 3: click the 'camera' button
Step 4: notice the camera works properly
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var camera_button = Titanium.UI.createButton ({
    title:'Camera',
    height:60,
    bottom: 10,
    width:160
});
camera_button.addEventListener ('click', function(e) {  
    
    Titanium.Media.showCamera ({
        
        saveToPhotoGallery: true,
        allowEditing: true,
        // top:100,
        // width:'auto',
        
        success: function(event){
            var a = Titanium.UI.createAlertDialog({
                title: 'You did it!'
            });
            a.show();
        },
        
        error: function(error){
            var a = Titanium.UI.createAlertDialog({
                title: 'Uh Oh...'
            });
            if (error.code == Titanium.Media.NO_CAMERA || error.code == Titanium.Media.NO_VIDEO) {
                a.setMessage('Sorry, this device does not have a camera. You knew that, right?');
            }
            else {
                a.setMessage('Unexpected error: ' + error.code);
            }
            a.show();
        }
                
    });
});
win1.add(camera_button);
win1.open();
Resources
ScreenShot and Video attached
Tested With
TiSDK 1.6.1, iPad 2, iOS 4.3
Associated Helpdesk Ticket
http://developer.appcelerator.com/helpdesk/view/76504">http://developer.appcelerator.com/helpdesk/view/76504
Attachments
| File | Date | Size | 
|---|---|---|
| bad_ipad_camera.png | 2011-04-15T03:43:16.000+0000 | 49809 | 
| ipad_camera_problem.mov | 2011-04-15T03:43:16.000+0000 | 344362 | 
(from [47df9dd21bf4febfde5e2a17c946bb9c7a590d62]) [#3362 status:fixed-in-qa] Implement displayCamera:, fix up closeModalPicker: and properly track lifetime of popover so that showCamera will work on iPad2 and no longer be in a popover https://github.com/appcelerator/titanium_mobile/commit/47df9dd21bf4febfde5e2a17c946bb9c7a590d62"> https://github.com/appcelerator/titanium_mobile/commit/47df9dd21bf4...
Tested with 1.7.0.879871b...(05/10/11 19:34) on iPad 2 (4.3.3)