How to create raw image in iOS? - iphone

I want to create raw image using UIImagePickerController. I'm doing like this but getting crash on this line uiipc.mediaTypes=#[(NSString *)kUTTypeRawImage]; crash report says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'No available types for source 1'.
Code here
UIImagePickerController *uiipc = [[UIImagePickerController alloc] init];
uiipc.delegate=self;
uiipc.mediaTypes=[UIImagePickerController availableMediaTypesForSourceType:uiipc.sourceType];
// uiipc.mediaTypes = #[(NSString *)kUTTypeImage];
uiipc.mediaTypes=#[(NSString *)kUTTypeRawImage];// Getting crash here
uiipc.sourceType = UIImagePickerControllerSourceTypeCamera;
uiipc.allowsEditing = YES;
_imgPickViewController=uiipc;
[self presentViewController:_imgPickViewController animated:NO completion:nil];

Related

GKLeaderboard in SpriteKit?

How can I use a GKLeaderboard in SpriteKit ?
When I try to present a Leaderboard a got this issue.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setShowsFPS:]: unrecognized selector sent to instance 0x17017fb00'
First throw call stack:
(0x18df0ef50 0x19a4181fc 0x18df13c04 0x18df11930 0x18de315dc 0x100069e00 0x190ed8670 0x190ed83f4 0x190fccd08 0x18df13700 0x18de2ceec 0x1911d5ee4 0x18ed278dc 0x18df13700 0x18de2ceec 0x19a9f0014 0x19a9effd4 0x19a9f31dc 0x18decec2c 0x18deccf6c 0x18de0dc20 0x193af5c0c 0x190f3efdc 0x1000dcb34 0x19aa0baa0)
libc++abi.dylib: terminating with uncaught exception of type NSException**
My Method to show the leaderboard:
-(void) showLeader
{
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil)
{
leaderboardController.leaderboardDelegate = self;
[self presentModalViewController:leaderboardController animated:YES];
}
}
Thanks in advance!
presentModalViewController was deprecated in iOS 6. GKLeaderbardViewController is deprecated in iOS 7.
You an refer to this:
What should I use instead of deprecated GKLeaderboardViewController in iOS7?

Cordiva CDVViewController crash gives 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'

I want create native ios app with "Cleaver" element WebView, but at compilation in simulator I get crash with error:
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
It's My code ViewDidLoad
- (void)viewDidLoad
{
[super viewDidLoad];
CDVViewController* viewController = [CDVViewController new];
viewController.view.frame = CGRectMake(0, 40, 320, 450);
[self.view addSubview:viewController.view];
}
I got the same error. This is not a solution, but I got CDVViewController working using earlier version of PhoneGap (2.4.0) without problems.

How to find what kind of parameters is required for undocumented version of handleGesture selector (for UIWebView)?

I have added a custom popup menu to UIWebView instance:
- (void)viewDidLoad
{
UILongPressGestureRecognizer* gesture = [[[UILongPressGestureRecognizer alloc]
initWithTarget:self action:#selector(handleGesture::)] autorelease];
}
- (void)handleGesture
{
}
- (void)handleGesture:(UIGestureRecognizer*)gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
[gestureRecognizer.view becomeFirstResponder];
UIMenuController* mc = [UIMenuController sharedMenuController];
[mc setTargetRect: gestureRecognizer.view.frame inView: gestureRecognizer.view.superview];
[mc setMenuVisible: YES animated: YES];
}
And it works! Until I focus textarea (CodeMirror editor) on a webpage. At this case I have the following exception:
-[FirstViewController handleGesture::]: unrecognized selector sent to instance 0x20369c00
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstViewController handleGesture::]: unrecognized selector sent to instance 0x20369c00'
*** First throw call stack:
(0x3608c2a3 0x3439c97f 0x3608fe07 0x3608e531 0x35fe5f68 0x3747ad31 0x374423dd 0x3762f479 0x37366837 0x3736529b 0x360616cd 0x3605f9c1 0x3605fd17 0x35fd2ebd 0x35fd2d49 0x3650f2eb 0x373b1301 0x140bb 0x14060)
libc++abi.dylib: terminate called throwing an exception
(lldb)
I think it's required to implement undocumented version of handleGesture selector with exotic parameters. Is it right? How to find what kind of parameters is required?
The correct code:
initWithTarget:self action:#selector(handleGesture:)] autorelease];

UIImagePickerController crashes on iOS4

When trying to show the UIImagePickerController I had strange problems with my app crashing on iOS4. Here's the output from log:
malloc: *** error for object 0x550ba20: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Setting breakpoints, trying to spy the name of the object 0x550ba20 (with print-object) does not work. Enabling zombie detection also does not work. Here is my code:
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
cameraPicker = [[UIImagePickerController alloc] init];
cameraPicker.delegate = self;
cameraPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Insert the overlay:
cameraPicker.cameraOverlayView = self.overlay;
self.cameraPicker.delegate = self;
//Hide controls
cameraPicker.showsCameraControls = NO;
cameraPicker.navigationBarHidden = YES;
// Make camera view full screen:
cameraPicker.wantsFullScreenLayout = YES;
cameraPicker.cameraViewTransform = CGAffineTransformScale(self.cameraPicker.cameraViewTransform, 1.0, 1.12412);
[self presentModalViewController:cameraPicker animated:NO];
[cameraPicker release];
Any ideas? Code is executed at the very end of viewDidLoad.
Is cameraPicker a property? You are initializing it first as a local variable and then using it as a property:
cameraPicker.cameraOverlayView = self.overlay;
!!self.!!cameraPicker.delegate = self;
and
cameraPicker.cameraViewTransform = CGAffineTransformScale(!!self.!!cameraPicker.cameraViewTransform, 1.0, 1.12412);

What is wrong with my code? I'm using MBProgressHUD

I'm using MBProgress HUD and I don't know what is the problem.
I have a UIButton that shows the HUD.
This is my code:
- (void)showHUD:(id)sender {
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.mode = MBProgressHUDModeCustomView;
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.labelText = #"No Internet Connection...";
HUD.opacity = 0.7;
HUD.customView =
[[UIImageView alloc] initWithImage:[UIImage imageNamed:#"image.png"]];
[HUD showWhileExecuting:#selector(hudWasHidden)
onTarget:self
withObject:nil
animated:YES];
}
- (void)hudWasHidden {
float progress = 0.0f;
while (progress < 1.0f) {
progress += 0.01f;
HUD.progress = progress;
usleep(50000);
}
}
Here is the Console log:
2010-06-11 17:55:26.255 Dual Search[14166:207] * -[MBProgressHUD setCustomView:]:
unrecognized selector sent to instance 0x6321220 2010-06-11 17:55:26.256 Dual
Search[14166:207] Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '** -[MBProgressHUD setCustomView:]:
unrecognized selector sent to instance 0x6321220' 2010-06-11 17:55:26.256 Dual
Search[14166:207] Stack: ( 41853515, 2505499913, 42125115, 41587990, 41584658,
13036, 2853830, 3324117, 3332879, 3328066, 2977128, 2871789, 2903111, 49860988,
41394236, 41390152, 49854621, 49854818, 2895329, 10508, 10362 )
My app always crashes when clicking the UIButton.
Thanks
This is a common crash in Cocoa code: "unrecognized selector" is very explicit in this case. MBProgressHUD doesn't have a customView property, and attempting to set it is causing the crash. The setCustomView is the implicit selector (method) being called here, and Objective-C will crash when a called method isn't there.
Not sure what to tell you about how to accomplish what you're trying to do.