iOS Question iMedia Lib problem....

ilan

Expert
Licensed User
Longtime User
hi, i am using the imedia lib to use cam.takepicture and cam.takevideo

the problem is when i use the camera more then once my app crashes.

it does not happen everytime sometimes it works ok but sometimes it crashes...

 

ilan

Expert
Licensed User
Longtime User
Are you able to reproduce it with a simple project?

yes, and it happens on my ipad (on iphone everything is fine)

i start camera and then hit cancel again camera again cancel after few times it crashes..
also when i load image after few times it crashes...


apple report (reason why they rejected my app)

 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Is the iPad running iOS 8?

Are you sure that it happens when you are calling TakePicture and not only with SelectFromPhoto...?


yes the ipad is running ios8+, and it happend also when i only tried to take a pic...

what i have done is, i changed the TARGETED_DEVICE_FAMILY = "1,2" to TARGETED_DEVICE_FAMILY = "1" (LINE 240 only) so it will run only on iphones, and i was still able to install it on my ipad2 (ios8) and now everything works perfect...

i tought if i change the target device family it wont be installed on ipads but it did, if i will upload my build like this ipads wont find it right??

*************

i will try also your second advice (intialize the cam before use it)
 
Upvote 0

Mark Turney

Active Member
Licensed User
Longtime User
Erel's suggestion to reinitialize the cam each time worked to resolve the iPad crash for me. Here's the code I used .... works on iPhone and iPad now, no matter how many times I switch back and forth between take pic and choose image. My devices are iPhone 6 plus and iPAD Mini original model, both running iOS 8.1.3.
B4X:
Sub imgPrompt_click(ButtonText As String)                                                  
    If App.iPadDevice = True Then
        If ButtonText = "Take" Then
            cam1.Initialize("cam1", Page1)
            cam1.TakePicture
            takePicOrChoose = 1
        Else
            chooseView.Visible = True
            cam1.SelectFromPhotoLibrary(chooseView, cam1.TYPE_IMAGE)
            takePicOrChoose = 2
        End If
    Else
        If ButtonText = "Take" Then
            cam1.TakePicture
            takePicOrChoose = 1
        Else
            cam1.SelectFromPhotoLibrary(Sender, cam1.TYPE_IMAGE)
            takePicOrChoose = 2
        End If
    End If
End Sub
  
Sub cam1_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
        If Success Then
            If Image.IsInitialized Then
                GraphPaper.ContentMode = GraphPaper.MODE_FIT
                GraphPaper.Bitmap = Image
            End If
        End If
  
    If takePicOrChoose = 1 Then                                'Checks a variable in order to save original image if taken (before user modifies pic)
        Phone.AddImageToAlbum(GraphPaper.Bitmap)
    End If
    chooseView.Visible = False
End Sub
Hope this helps someone!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…