I want to add a "bubble horizon" to a camera application to show if the user is keeping their phone level.
For this, I'm using the Motion Attitude functionality of CMMotionManager.
However, the output I'm getting is very inaccurate. I'm comparing it with Apple's own Measure app which is dead accurate, so the sensors are working fine. My own readings seem to be several degrees off.
Am I missing some calibration step or something?
- (void)processDeviceMotion:(CMDeviceMotion *)motion {
// use quaternions to avoid Gimbal Lock
CMQuaternion quat = motion.attitude.quaternion;
// calculate roll in degrees
double roll = atan2( 2 * ( quat.w * quat.x + quat.y * quat.z ), 1 - 2 * ( quat.x * quat.x + quat.y * quat.y ) );
roll = radiansToDegrees( roll );
NSLog( @"Roll: %f", roll );
}
Post
Replies
Boosts
Views
Activity
I'm experimenting with getting my AUv3 plugins working correctly on iOS and MacOS using Catalyst.
I'm having trouble getting the plugin windows to look right in Logic Pro X on MacOS.
My plugin is designed to look right in Garageband's minimal 'letterbox' layout (1024x335, or ~1:3 aspect ratio)
I have implemented supportedViewConfigurations to help the host choose the best display dimensions
On iOS this works, although Logic Pro iPad doesn't seem to call supportedViewConfigurations at all, only Garageband does.
On MacOS, Logic Pro does call supportedViewConfigurations but only provides oversized screen sizes, making the plugins look awkward.
I can also remove the supportedViewConfigurations method on MacOS, but this introduces other issues:
I guess my question boils down to this: how do I tell Logic Pro X on MacOS what the optimal window size of my plugin is, using Mac Catalyst?
I'm 'porting' an iPad app to MacOS using Mac Catalyst, and I'm having trouble getting the document share sheet to work properly.
I've tried two ways and they both result in the same thing: no share sheet appears, but only a little popup with a "More..." button (see image).
Attempt #1: using a UIDocumentInteractionController...
NSURL* url = [NSURL fileURLWithPath:fileToShare];
UIDocumentInteractionController* docController = [UIDocumentInteractionController interactionControllerWithURL:url];
[docController presentPreviewAnimated:YES];
[docController presentOptionsMenuFromRect:CGRectMake(x, y, 0, 0) inView:currentView animated:YES];
Attempt #2: using a UIActivityViewController...
NSURL* url = [NSURL fileURLWithPath:fileToShare];
NSArray* shareData = @[url];
UIActivityViewController* activityController = [[UIActivityViewController alloc] initWithActivityItems:shareData applicationActivities:nil];
[self presentViewController:activityController animated:YES completion:NULL];
Since both mechanisms consistently give the same result (both work on iOS and not on MacOS), I have a feeling I need to set some kind of permission or entitlement to get this working on MacOS. But I can't find any hints or documentation to support this.
I need to know how much Apple actually pays out for a specific app (which seems to be ~6% lower than the estimated proceeds they publish in the dashboard).
I only see the totals per country, which are aggregates for all my apps. What's the trick? Is there a link I'm overlooking on App Store Connect?
My app successfully receives midi from BT MIDI devices when they are enabled through the CABTMidiLocalPeripheralViewController pattern. However, I would like the app to automatically reconnect to these BT MIDI devices in subsequent sessions whenever they are available. Is this possible without requiring the user to go through the connection view controller every time?
I'm developing an iOS Extension (Audio Unit Extension) and I had provided a temporary icon set for it in the default asset catalog. However, I now can't change the old icon for a new final icon anymore.Providing/replacing all icon files in the AppIcon asset catalog changes only the icons of the app containing the extension, but not the icon of the extension itself. All Audio Unit hosts keep displaying the old icon.I've cleaned the project and product folder, rebuilt in every way; removed asset catalogs, etc. no dice. Anyone know of a solution?XCode 7.3, iOS 9.3.4
My Audio Unit v3 is trying to get the tempo from the host, but I'm a bit lost.Apparently there is an AUHostMusicalContextBlock block property in my Audio Unit, but I can't figure out how to use it.It's now part of my render block, but it crashes my plugin...- (AUInternalRenderBlock)internalRenderBlock {
/
__block PluginKernel *plugin = &_kernel;
/
// get the tempo
double currentTempo;
if ( self.musicalContextBlock( &currentTempo, NULL, NULL, NULL, NULL, NULL ) == YES ) {
plugin->handleTempoSetting(currentTempo);
}
// do the render processAnyone already got this to work?Thanks!Bram