UIImagePicker crash on iPad IOS5 - uiimagepickercontroller

does anybody see what's wrong with this code?
UIImagePickerControllerSourceType pickerType = UIImagePickerControllerSourceTypePhotoLibrary;
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:pickerType];
[imagePicker setMediaTypes:[UIImagePickerController availableMediaTypesForSourceType:pickerType]];
[imagePicker setDelegate:self];
UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[pop setDelegate:self];
[pop presentPopoverFromRect:CGRectMake(100, 100, 100, 100) inView:self permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[pop setPopoverContentSize:CGSizeMake(300, 500)];
On ios4 it works well. But on ios5/ipad it crashes with
*** Assertion failure in -[PLHighlightingTableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:6072
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
The exception occurs when I scroll the image picker.
Any ideas?
Regards
-dezember

Related

How to save a _flutterFFmpeg gif in firebase storage?

Edit:
After some changes with help from #Frank van Puffelen
I getting a new error see below updated code and updated error
Hello everyone im trying to save a gif which I create with flutter_ffmpeg: ^0.4.2
With this code im trying to create a gif of picked video from user which is currently widget.videopathasstring
THis is the path of picked video.
Directory gifDirectory;
String gifOutputFile;
getpreviewvideo() async {
String currentvideo = widget.videopathasstring;
await getApplicationDocumentsDirectory().then((directory) {
print("13");
gifDirectory = Directory(directory.path + '/gif');
print("14");
gifDirectory.exists().then((exists) async {
print("0");
if (!exists) {
print("1");
await gifDirectory.create();
}
}).then((value) => {
print("3"),
gifOutputFile = gifDirectory.path +
'/' +
DateTime.now().millisecondsSinceEpoch.toString() +
'.gif',
});
});
print("4");
var arguments = [
'-i',
currentvideo,
'-t',
'2.5',
'-ss',
'2.0',
'-f',
'gif',
gifOutputFile,
];
_flutterFFmpeg.executeWithArguments(arguments).then((rc) {
print("FFmpeg process exited with rc $rc");
});
return File(gifOutputFile);
}
The problem is im getting this error
GTMSessionFetcher invoking fetch callbacks, data {length = 0, bytes = 0x}, error (null)
2
GTMSessionFetcher invoking fetch callbacks, data {length = 613, bytes = 0x7b0a2020 226e616d 65223a20 22616c6c ... 36316263 34220a7d }, error (null)
flutter: 13
flutter: 14
flutter: 4
flutter: Invalid argument(s) (path): Must not be null
flutter: 0
-[NSNull length]: unrecognized selector sent to instance 0x1dc5f0558
flutter: 3
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x1dc5f0558'
*** First throw call stack:
(0x181e8904c 0x19a4fdf54 0x181f66014 0x181e1e474 0x181e1d5b0 0x181e15410 0x181e0d0a0 0x100e3c4b8 0x100e3b324 0x100e3bb24 0x10065528c 0x181af9914 0x181afb660 0x181afe788 0x181b0cdd0 0x181b0d5f8 0x1f212a0b8 0x1f2129e94)
libc++abi: terminating with uncaught exception of type NSException
* thread #65, queue = 'com.apple.root.default-qos', stop reason = signal SIGABRT
frame #0: 0x00000001b8cd0964 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1b8cd0964 <+8>: b.lo 0x1b8cd0984 ; <+40>
0x1b8cd0968 <+12>: pacibsp
0x1b8cd096c <+16>: stp x29, x30, [sp, #-0x10]!
0x1b8cd0970 <+20>: mov x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Exited (sigterm)
Hope anyone can help
It seems you're not uploading the file to Cloud Storage, which only happens once you call putFile.
Have a look at the FlutterFire documentation on uploading files for an example of how to use putFile

No visible #interface for 'UIApplication' declares the selector 'registerForRemoteNotifications:' AppDelegate.m

I just switched to xcode 6 and ios8, I was trying to fix some warnings. The warnings were about some deprecated methods. So I changed the code in AppDelegate.h for push notifications to work with iOS 8 but I get errors
old code(xcode 5, iOS7)
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
New Code for iOS8
[[UIApplication sharedApplication] registerForRemoteNotifications:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
How Can resolve this error?
Read the documentation. This is not how you use registerForRemoteNotifications. You call registerUserNotificationSettings: with the appropriate settings, and finally call [[UIApplication sharedApplication] registerForRemoteNotifications]; to register.

gracenote sdk for music id not working on iOS 7 device

here is what we have done:
we added the framework to our project and
have the following in one of our classes:
GCSearchViewController.h
#interface GCSearchViewController : UIViewController<UISearchBarDelegate, GNSearchResultReady, GNAudioSourceDelegate>
GCSearchViewController.m
// - As per the web tutorial
#import <GracenoteMusicID/GNConfig.h>
#import <GracenoteMusicID/GNOperations.h>
#import <GracenoteMusicID/GNSearchResponse.h>
#import <GracenoteMusicID/GNSearchResult.h>
// - As per what we saw in the demo app
#import <GracenoteMusicID/GNRecognizeStream.h>
#import <GracenoteMusicID/GNAudioConfig.h>
#import <GracenoteMusicID/GNAudioSourceMic.h>
#import <AVFoundation/AVAudioSession.h>
…
#pragma mark - Gracenote Delegate
-(void) identifySong {
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL response){
NSLog(#"Allow microphone use response: %d", response);
if (response) {
[GNOperations recognizeMIDStreamFromMic:self config:self.config];
}
}];
}
- (void) GNResultReady:(GNSearchResult *) result
{
GNSearchResponse *best = [result bestResponse];
if (![result isFailure] && (best.artist!=nil)) {
NSLog(#"Artist %#", best.artist);
NSLog(#"Song name %#", best.trackTitle);
} else {
NSLog(#"No Match");
}
}
- (void) audioBufferDidBecomeReady:(GNAudioSource*)audioSource samples:(NSData*)samples {
NSError *err;
err = [self.recognizeFromPCM writeBytes:samples];
if (err) {
NSLog(#"ERROR: %#",[err localizedDescription]);
}
}
this code works ok in the simulator, but whenever we run it on the device (ipod touch 5th or iphone 5) the app breaks with the following error:
2013-11-16 22:00:40.402 GC[1758:60b] 22:00:40.401 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)
Error: 0xffffd59d2013-11-16 22:00:52.904 Leaf[1758:60b] Allow microphone use response: 1
2013-11-16 22:00:52.925 GC[1758:60b] 22:00:52.925 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)
Error: 0xffffd59d2013-11-16 22:00:52.927 GC[1758:60b] *** Assertion failure in -[GNFingerprinterQueue startupTimerFired], /home/mobile/z-15003-ecma-3.2/cddb-clients/mmid/iOSMobileSDK/3.2/Classes/Private/GNFingerprinterQueue.m:291
2013-11-16 22:00:52.930 GC[1758:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'audioSource is nil'
*** First throw call stack:
(0x2fb66f4b 0x39e7b6af 0x2fb66e25 0x3050efe3 0x151849 0x1520e5 0x3054ae9b 0x2fb32183 0x2fb31653 0x2fb2fe47 0x2fa9ac27 0x2fa9aa0b 0x3478a283 0x3233e049 0x7b621 0x3a383ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
our app is targeting iOS7... appreciate any pointers on how to make it work
This is an error with acquiring the Microphone hardware. The error log:
2013-11-16 22:00:40.402 GC[1758:60b] 22:00:40.401 ERROR: [0x3c29f18c] >aurioc> 783: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 1 ch, 44100 Hz, Int16>)
Above error happens in two cases:
Microphone Hardware was not configured correctly OR
RemoteIO was unable to acquire hardware.
This is typically happens with Simulator but can happen on the device if the microphone is inaccessible. The error can also happen if AVAudioSession is not correctly configured or is messed up. Check AVAudioSession configuration and Try deleting the iOS app, re-installing it and doing a clean build.

setTitle of UITabBarController crashed in iOS 5 for more than 5 items?

Before updating my Xcode from 4.1 to 4.2 the following was code was working fine with iOS 4.3, but after upgrading Xcode and test my app on iPhone with iOS 5 it keep crashing on startup!
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window addSubview:tabController.view];
[[tabController.tabBar.items objectAtIndex:0] setTitle:#"Tab1"];
[[tabController.tabBar.items objectAtIndex:1] setTitle:#"Tab2"];
[[tabController.tabBar.items objectAtIndex:2] setTitle:#"Tab3"];
[[tabController.tabBar.items objectAtIndex:3] setTitle:#"Tab4"];
[[tabController.tabBar.items objectAtIndex:4] setTitle:#"Tab5"];
[[tabController.tabBar.items objectAtIndex:5] setTitle:#"Tab6"];
[[tabController.tabBar.items objectAtIndex:6] setTitle:#"Tab7"];
[[tabController.tabBar.items objectAtIndex:7] setTitle:#"Tab8"];
[[tabController.tabBar.items objectAtIndex:8] setTitle:#"Tab9"];
[self.window makeKeyAndVisible];
return YES;
}
It throws the following error:
2011-10-15 15:13:31.238 Mobile[2347:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 5 beyond bounds [0 .. 4]'
*** First throw call stack:
(0x311138bf 0x382b81e5 0x3106b275 0x336b 0x330e57eb 0x330df3bd 0x330ad921 0x330ad3bf 0x330acd2d 0x33c98e13 0x310e7553 0x310e74f5 0x310e6343 0x310694dd 0x310693a5 0x330de457 0x330db743 0x2acd 0x2a28)
If I kept only the first 5 setTitle it will work, but if its more than 5 it will crash!
Please note that I'm creating the UITabBarController in IB not programatically.
Try accessing the viewControllers array on the tabController instead and editing the tabItem on the View Controller directly.
[[tabController.viewControllers objectAtIndex:0].tabBarItem setTitle:#"Tab1"];

How to run the "screen" command from NSTask?

I want to monitor a virtual COM port (Arduino RFID) on my Mac. I can run "screen /dev/tty.serialnumber" from the terminal, and it outputs the RFID serial number when I swipe it.
As soon as I try it from Xcode with an NSTask I get the following output.
Must be connected to a terminal.
Here's my code:
NSTask *cd = [[NSTask alloc] init];
[cd setLaunchPath:#"/usr/bin/screen"];
[cd setArguments:[NSArray arrayWithObjects:#"-L",#"/dev/tty.usbserial-A800509K",nil]];
NSPipe *pipe;
pipe = [NSPipe pipe];
[cd setStandardOutput: pipe];
[cd setStandardInput:[NSPipe pipe]];
NSFileHandle *file;
file = [pipe fileHandleForReading];
[cd launch];
NSData *data;
data = [file readDataToEndOfFile];
NSString *string;
string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog (#"%#", string);
[cd waitUntilExit];
[cd release];
I think you'd better directly access the COM port, either by using the foundation libraries, or by using third party Obj-C libs (for example, https://github.com/pbosetti/PBSerialPort).
Also, if you want to monitor the COM port, you will have to set a thread reading the serial port, and updating a text area in the UI. Remember that secondary thread should update the UI via the method - (void)performSelector:(SEL)aSelector onThread:(NSThread *)thr withObject:(id)arg waitUntilDone:(BOOL)wait.

Resources