Camera controls in Zbar - ios

Hi I am trying to show camera controls using zbar in ios for scanning.
i have written following code
ZBarReaderViewController *readerController = [[ZBarReaderViewController alloc] init];
readerController.sourceType = UIImagePickerControllerSourceTypeCamera;
readerController.tracksSymbols = YES;
readerController.showsCameraControls = YES;
readerController.showsZBarControls = YES;
[readerController release];
But application crash every time when i show zbar controller.
and app work fine if i remove this line
readerController.showsCameraControls = YES;
But then i can not see any control on scan view

"BOOL showsCameraControls Raises an exception if anything other than NO is set."
Check the following link for details: ZBarReaderViewController Class Reference. Cheers

Related

taking a picture in iOS app

i cannot seem to get this right. ive looked at several tutorials with no luck. i realize it is a simple task, which is why i am so confused on why it isnt working for me.
i have a programmatically made button inside an expanding cell and when you press it, it is suppose to access the camera to take a picture. i have this code:
- (void)buttonPressed:(UIButton *)button {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[picker setDelegate:self];
//picker.allowsImageEditing = NO;
[self presentModalExpandingCell:picker animated:YES];
picker.showsCameraControls = YES;
}
the error appears in line 5. and says "no visible #interface for 'ExpandingCell' declares the selector 'presentModalExpandingCell:animated:'" i have "" in the .h file so i have no idea what to do.
any help will be greatly appreciated. thanks in advance.
Have you declared the method "presentModalExpandingCell" in your class? Because, if not, that is why the compiler is throwing that error.

App using a map (apple or google) often killed due to memory pressure (Mainly happens when going to Camera)

Description
my app is only using 35-70mb and is sometimes getting killed with 35mb in the report. The reason always being vm-pageshortage
go from any map view to the camera (repeat N times. on devices with a lot of free RAM it takes longer of course)
you will start (quite soon(!) to receive memory warnings
BOOM (killed)
This works in any app that uses either MKMapKit or GoogleMaps. I guess it is related some graphics data that doesnt show up in instruments but is in the VM.
This didnt happen in IOS6
GMS Bug Tracker issue with DEMO code
https://code.google.com/p/gmaps-api-issues/issues/detail?id=6209&thanks=6209&ts=1388925382)
question 1
Im releasing the objects just fine on my side and I see dealloc is called correctly.
=> can I somehow influence MapKit / GoogleMaps to release VM space.
question 2
What's strange is that according to the report there are even bigger apps on the system but ours gets killed:
=> Is there some mechanic in the whatchdog to prefer to kill DEBUG (or maybe non-appstore) apps before appstore apps?
Sample project:
only 1 view controller, only 1 map (via Apple MapKit, GMS is equally bad), push camera and take a pic--- BOOM
runnable code: https://dl.dropboxusercontent.com/u/3753090/MapKitTest.zip
- (void)loadView {
UIView *v = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
CGRect f = v.bounds;
mapView = [[MKMapView alloc] initWithFrame:CGRectInset(f, 5, 5)];
[v addSubview:mapView];
self.view = v;
}
- (void)viewDidAppear:(BOOL)animated {
[self performSelector:#selector(delayed) withObject:nil afterDelay:3];
}
- (void)delayed {
UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = (id)self;
imagePickerController.showsCameraControls = NO;
[self presentViewController:imagePickerController animated:YES completion:nil];
[imagePickerController performSelector:#selector(takePicture) withObject:nil afterDelay:2];
}
- (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage* image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *jpg = UIImageJPEGRepresentation(image, 0.8);
NSLog(#"jpg %d", ((const char*)jpg.bytes)[0]);
[self dismissViewControllerAnimated:YES completion:nil];
}
an instruments screenshot:
https://www.dropbox.com/s/v1v5ll8v5kjt7ev/Screenshot%202014-01-05%2021.00.58.png
and the report:
https://dl.dropboxusercontent.com/u/3753090/report%2005-01-14%2021-00.crash
apple acknowledged the bug and claims to have fixed it with 7.1 -- anyhow they confirmed the issue so there is no mistake on my side.
I guess a 4s is just no device for ios7 anymore :)

Google Maps iOS + Storyboard + Segue = Crash

What I do in my app is following:
I load some data into the core data and when that is finished app needs to segue to the next view (google map)
[self performSegueWithIdentifier:#"loadMap" sender:self];
but I get this error
Terminating app due to uncaught exception 'GMSThreadException', reason: 'All calls to the Google Maps SDK for iOS must be made from the UI thread'
If I do all of this but make a segue with tap on a button everything works fine.
Google map view controller in storyboard has one GMSMapView view outlet with init code
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:45.331875
longitude:14.450455
zoom:14];
self.mapView.camera = camera;
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = camera.target;
marker.title = #"Test title";
marker.snippet = #"Lorem ipsum...";
marker.map = self.mapView;
Can anybody help me here? How can I load view controller with google maps programmatically using storyboard?
The exception seems to be indicating that you're trying to perform a segue in the background thread. To stop it from crashing, you need to use the main thread instead. Wrap your performSegueWithIdentifier:sender: as follows to use the main thread:
dispatch_async(dispatch_get_main_queue(), ^{
[self performSegueWithIdentifier:#"loadMap" sender:self];
});
For Swift:
dispatch_async(dispatch_get_main_queue(), {})
Toss the code in those curlies...

<Error>: CGAffineTransformInvert: singular matrix. in UIimagepickercontroller [duplicate]

I tried this twice with two different apps and I get the same thing. I have a set up a UIImagePIckerController instance as follows:
- (IBAction)addImage:(UIBarButtonItem *)sender {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
NSArray *mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
if ([mediaTypes containsObject:(NSString *)kUTTypeImage]) {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
picker.allowsEditing = NO;
picker.showsCameraControls = NO;
[self presentViewController: picker animated:YES completion:NULL];
}
[..]
}
This was the second. In the first I set up a custom overlay to run the shutter and other functions. Everything runs fine but I keep getting an error on the console:
<Error>: CGAffineTransformInvert: singular matrix.
When I run the app, every time I rotate (or move about which signals a rotate) the device while the camera is up {something happens here}. I tried it on both my iPhone 4 and iPad Mini with the same results. After a lot of digging I found this only happen in the case where
picker.showsCameraControls = NO;
If I put
picker.showsCameraControls = YES;
Then I get no message (though my custom overlay is hidden too). Making sure it wasn't the custom overlay itself I tried leaving that out, and it still gives the error message.
Anybody got any ideas of what I should do about this?
I believe it to be largely benign as Apple's own PhotoPicker sample code generates this warning. Rotation has to do with matrices and while I'm not sure which matrix in particular is getting rotated, it is considered a mathematical violation to perform operations on matrices with a determinant of zero (similar to dividing by zero). Such a matrix is not invertible or 'singular':
http://en.wikipedia.org/wiki/Rotation_matrix
http://en.wikipedia.org/wiki/Determinant
http://en.wikipedia.org/wiki/Singular_matrix#singular

How to import video from library in iPhone into my application?

I know that this question been asked before, but I'm getting an error while I'm running this code for picking video.
-(void)video
{
UIImagePickerController *imagePicker =
[[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie,nil];
[self presentModalViewController:imagePicker animated:YES];
}
This code taking me to a window where video should appear. But the window is blank. The message showing is "No Videos you can sync photos and videos onto your iPod.............albums and videos" . I know that this message shows when there is no videos in video library. But I import lot of videos and still showing this error.
You should take a look at this "HowTo" : http://www.raywenderlich.com/13418/how-to-play-record-edit-videos-in-ios. It helped me a lot.
You will only need the first part.

Resources