Declaring usage access to Microphone for privacy settings in info.plist iOS 10 - ios10

In my project i am using a hardware that uses the headphone jack to connect to the device and used to swipe card. Do i need to declare the usage access for microphone in info.plist?
My problem is few of my users reporting that the application crashes after login. from the below crash log i suspect that the related to an issue in accessing the privacy settings(i am not sure though). Please check the crash log as well and guide me on how to solve this issue.
#9. Crashed: com.apple.root.default-qos
0 libsystem_kernel.dylib 0x18ae60d74 __abort_with_payload + 8
1 libsystem_kernel.dylib 0x18ae5d480 abort_with_payload_wrapper_internal + 100
2 libsystem_kernel.dylib 0x18ae5d4c8 system_set_sfi_window + 10
3 TCC 0x18e0a0328 __TCCAccessRequest_block_invoke_2.80 + 258
4 TCC 0x18e0a0224 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 702
5 TCC 0x18e0a3330 __tccd_send_block_invoke + 348
6 libxpc.dylib 0x18af6601c _xpc_connection_reply_callout + 80
7 libxpc.dylib 0x18af65f8c _xpc_connection_call_reply + 40
8 libdispatch.dylib 0x18ad1d1c0 _dispatch_client_callout + 16
9 libdispatch.dylib 0x18ad2bab4 _dispatch_queue_override_invoke + 732
10 libdispatch.dylib 0x18ad2d38c _dispatch_root_queue_drain + 572
11 libdispatch.dylib 0x18ad2d0ec _dispatch_worker_thread3 + 124
12 libsystem_pthread.dylib 0x18af262b8 _pthread_wqthread + 1288
13 libsystem_pthread.dylib 0x18af25da4 start_wqthread + 4

I think you have to use UISupportedExternalAccessoryProtocols permission for user external hardware.
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>PROTOCOL_NAME_HERE</string>
</array>
PROTOCOL_NAME_HERE is bundle identifier of your protocol/external accessory.
And you have to add ExternalAccessory.framework in your project (Click on your project in the Project Navigator on the left side. In General go to "Linked Frameworks and Libraries". Click on the + button).

Related

What causes apps to crash on resume after a long time in background?

I'm finding that after my app has been in the background for a while, (half hour + maybe) it crashes immediately on resume.
Crash log reveals that it is EXC_BAD_ACCESS, but I'm at loss for how to debug this one, because I don't know what gets released when my app goes to background (for a long time in particular). (Exception codes are 0x0000000 repeated)
Is there any documentation on this / can anyone give insight about what they did to fix this in the past?
While we're at it, is there a way to test this without waiting for hours before each try? Some way to simulate whatever it is that is happening to my app?
Thanks
Update
I just read a bit more closely, and there's something here about a timer, I added some stuff that uses timers recently to my app, could this give more info? (See item 12)
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x32858a1c __pthread_kill + 8
1 libsystem_c.dylib 0x337013b4 pthread_kill + 52
2 libsystem_c.dylib 0x336f9bf8 abort + 72
3 libstdc++.6.dylib 0x30504a64 __gnu_cxx::__verbose_terminate_handler() + 376
4 libobjc.A.dylib 0x3068f06c _objc_terminate + 104
5 libstdc++.6.dylib 0x30502e36 __cxxabiv1::__terminate(void (*)()) + 46
6 libstdc++.6.dylib 0x30502e8a std::terminate() + 10
7 libstdc++.6.dylib 0x30502f5a __cxa_throw + 78
8 libobjc.A.dylib 0x3068dc84 objc_exception_throw + 64
9 MarsCrash 0x0000be88 0x1000 + 44680
10 MarsCrash 0x00020646 0x1000 + 128582
11 Foundation 0x327196ce __NSFireDelayedPerform + 362
12 CoreFoundation 0x334e7a40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
13 CoreFoundation 0x334e9ec4 __CFRunLoopDoTimer + 844
14 CoreFoundation 0x334ea83e __CFRunLoopRun + 1082
15 CoreFoundation 0x3347aebc CFRunLoopRunSpecific + 224
16 CoreFoundation 0x3347adc4 CFRunLoopRunInMode + 52
17 GraphicsServices 0x311a5418 GSEventRunModal + 108
18 GraphicsServices 0x311a54c4 GSEventRun + 56
19 UIKit 0x31b90d62 -[UIApplication _run] + 398
20 UIKit 0x31b8e800 UIApplicationMain + 664
21 MarsCrash 0x00002558 0x1000 + 5464
22 MarsCrash 0x00002500 0x1000 + 5376
Common case for such situations is a call to an object that was released due to low memory warnings. EXEC_BAD_ACCESS — accessing to over-release object according to Apple's source (http://developer.apple.com/library/mac/#qa/qa1367/) You can find an actual source of the problem by taking a crash logs from your device and symbolizing it to an actual code strings in your product. I assume that knowing the class and method and code line number will give you a preliminary understanding what goes wrong in your code. Please, review following apple's article to understand further details — http://developer.apple.com/library/ios/#technotes/tn2151/_index.html
For an advanced topics on debugging following link maybe also very useful — http://developer.apple.com/library/ios/#technotes/tn2239/_index.html Actually Apple provides a ton of difference ways to debug such type of an issue.
If it is indeed caused by a memory hit, you can try running it on the simulator, which has a menu item which lets you send your app a simulated memory warning. Your app will try to do all the things it does during a real memory warning, and that might help you find your bug. Also, look at running with NSZombies enabled You might want to check out this page -- I find it very helpful:
http://www.cocoadev.com/index.pl?DebuggingAutorelease

What is UICalloutBarButton, and why does it make my app crash?

I'm going through some of the reported crash reports for my iPhone app, and I'm stumped by the following.
It's very possible it crashes somewhere in my code - it may be an event handler calling the wrong selector somewhere. The problem is I have no idea WHERE this code is - I don't know what a UICalloutBarButton or UICalloutBar is.
Also, needless to say, I can't reproduce this on my end, otherwise it'd be easy to figure out where it's happening.
Date/Time: 2011-03-18 14:33:13.373 +0100
OS Version: iPhone OS 4.3 (8F190)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x317aaa1c __pthread_kill + 8
1 libsystem_c.dylib 0x355593b4 pthread_kill
2 libsystem_c.dylib 0x35551bf8 abort
3 libstdc++.6.dylib 0x33378a64 __gnu_cxx::__verbose_terminate_handler() + 376
4 libobjc.A.dylib 0x364b506c _objc_terminate
5 libstdc++.6.dylib 0x33376e36 __cxxabiv1::__terminate(void (*)()) + 46
6 libstdc++.6.dylib 0x33376e8a std::terminate() + 10
7 libstdc++.6.dylib 0x33376f5a __cxa_throw + 78
8 libobjc.A.dylib 0x364b3c84 objc_exception_throw
9 CoreFoundation 0x354e21b8 -[NSObject(NSObject) doesNotRecognizeSelector:]
10 CoreFoundation 0x354e1642 ___forwarding___
11 CoreFoundation 0x35458178 _CF_forwarding_prep_0 + 40
12 CoreFoundation 0x3544befc -[NSObject(NSObject) performSelector:withObject:]
13 UIKit 0x35e259b2 -[UICalloutBar buttonPressed:]
14 CoreFoundation 0x3544befc -[NSObject(NSObject) performSelector:withObject:]
15 UIKit 0x35e25cd4 -[UICalloutBarButton sendCallback]
16 Foundation 0x31d096ce __NSFireDelayedPerform
17 CoreFoundation 0x354b5a40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
18 CoreFoundation 0x354b7ec4 __CFRunLoopDoTimer
19 CoreFoundation 0x354b883e __CFRunLoopRun
20 CoreFoundation 0x35448ebc CFRunLoopRunSpecific
21 CoreFoundation 0x35448dc4 CFRunLoopRunInMode
22 GraphicsServices 0x328e8418 GSEventRunModal
23 GraphicsServices 0x328e84c4 GSEventRun
24 UIKit 0x35bffd62 -[UIApplication _run]
25 UIKit 0x35bfd800 UIApplicationMain
26 app name 0x000022d0 main + 36
27 app name 0x0000226c start + 44
UICalloutBar is a UIKit private API.
I think this is the contextual menu that appears on text selection... (Copy/Paste...)
Anyway, this crash really likes coming from internal APIs.
So I guess that it is :
An apple bug (check the iOS versions vs crash occurences)
OR someone with a jailbroken device with dirty extensions/tweaks messing internal APIs
I'm afraid that the chances you find a fix for this are very low. I hope I'm wrong! :)
I had a crash from this API too. I was allowing my tableView to copy cells which displays a context copy menu automatically.
The crash was the result of a user clicking the back button of the navigation bar instead of clicking this menu option. The menu doesn't get dismissed and stays floating on the window until someone taps it. By this time the UITableViewController subclass is popped off the navigation stack resulting in a message being sent to the deallocated instance.
This might be an Apple UIKit bug, I'm not sure. One solution is to dismiss the menu manually in your viewWillDisappear: method.
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:animated];
}

How to diagnose a KERN_PROTECTION_FAILURE

I am getting an interesting crash that I can never seem to replicate on the simulator:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000008
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x3212e86c 0x3212c000 + 10348
1 StockTwits 0x00016b06 0x1000 + 88838
2 Foundation 0x30718422 0x306db000 + 250914
3 Foundation 0x307183a4 0x306db000 + 250788
4 CFNetwork 0x30933e74 0x30923000 + 69236
5 CFNetwork 0x30927b70 0x30923000 + 19312
6 CFNetwork 0x30927e62 0x30923000 + 20066
7 CFNetwork 0x30927a60 0x30923000 + 19040
8 CFNetwork 0x30927a12 0x30923000 + 18962
9 CFNetwork 0x30927990 0x30923000 + 18832
10 CFNetwork 0x3092790e 0x30923000 + 18702
11 CoreFoundation 0x30352a86 0x302e1000 + 465542
12 CoreFoundation 0x30354768 0x302e1000 + 472936
13 CoreFoundation 0x30355504 0x302e1000 + 476420
14 CoreFoundation 0x302fe8e4 0x302e1000 + 121060
15 CoreFoundation 0x302fe7ec 0x302e1000 + 120812
16 GraphicsServices 0x31a776e8 0x31a74000 + 14056
17 GraphicsServices 0x31a77794 0x31a74000 + 14228
18 UIKit 0x323272a0 0x32321000 + 25248
19 UIKit 0x32325e10 0x32321000 + 19984
20 StockTwits 0x00002fd4 0x1000 + 8148
21 StockTwits 0x00002fa4 0x1000 + 8100
I have NSZombies enabled as well as stack logging. Ran through the static analyzer to make sure all objects are retained and released properly, though I have a feeling it is still related to retain/releasing.
Thoughts?
You must be dereferencing a NULL pointer, other than this crash does not happen. The Static Analyzer is a nice tool for getting hints on things you're doing wrong. However, it not finding an error does not mean that your program is bug-free. Also turning on zombies does not always help. Sometimes it's just a simple little oversight.
The fact the simulator does not show this problem doesn't say too much. In the end it's a different machine with a different processor and a different architecture. There are occasions where false code runs well on one platform but crashes on the other.
You should re-symbolicate you stack trace and have a close look at that function it's crashing in. If you want more help it's probably best to post some of the code here.
One more hint: these issues are often spread over multiple methods. The analyzer only sees one method at a time. You should have a look at what happened to the objects in your crashing method BEFORE it was entered.

UIWebView is crashing at the end of loading a page that contains embedded YouTube clips in iOS 4.0x

When I load a page that contains embedded YouTube clips in a UIWebView managed by a modal UIViewController then I crash out with this stack trace:
OS Version: iPhone OS 4.0.2 (8A400)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 YouTube 0x00002bac -[NSData(YTBase64) webSafeBase64Data] + 76
1 YouTube 0x000026aa -[YTDeviceAuthenticator _authenticate2] + 662
2 YouTube 0x00002a54 -[YTDeviceAuthenticator connectionDidFinishLoading:] + 504
3 Foundation 0x0003d422 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
4 Foundation 0x0003d3a4 _NSURLConnectionDidFinishLoading + 72
5 CFNetwork 0x00010e74 URLConnectionClient::_clientDidFinishLoading(URLConnectionClient::ClientConnectionEventQueue*) + 160
6 CFNetwork 0x00004b70 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo*, long) + 96
7 CFNetwork 0x00004e62 URLConnectionClient::ClientConnectionEventQueue::processAllEventsAndConsumePayload(XConnectionEventInfo*, long) + 850
8 CFNetwork 0x00004a60 URLConnectionClient::processEvents() + 64
9 CFNetwork 0x00004a12 URLConnection::multiplexerClientPerform(RunLoopMultiplexer*) + 30
10 CFNetwork 0x00004990 MultiplexerSource::perform() + 120
11 CFNetwork 0x0000490e MultiplexerSource::_perform(void*) + 2
12 CoreFoundation 0x00071a86 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
13 CoreFoundation 0x00073768 __CFRunLoopDoSources0 + 376
14 CoreFoundation 0x00074504 __CFRunLoopRun + 224
15 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
16 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
17 GraphicsServices 0x000036e8 GSEventRunModal + 108
18 GraphicsServices 0x00003794 GSEventRun + 56
19 UIKit 0x000062a0 -[UIApplication _run] + 396
20 UIKit 0x00004e10 UIApplicationMain + 664
21 MyApp 0x00002e94 main (main.m:13)
22 MyApp 0x00002e30 start + 44
This is not limited to one specific URL; it seems to happen whenever the page contains embedded YouTube clips, eg this one.
Other web pages load fine without a crash.
The crash happens before I can even get to clicking on the actual YouTube clip; it happens as the page containing the embedded clip finishes loading, before the webViewDidFinishLoad: delegate method is called (if I set a delegate).
I stripped out all my extra code, including removing all UIWebViewDelegate references and it still crashes in the same way when running as part of my app.
Strangely, when I extract the code into a new app, the new app works fine.
I also only see this on an iPhone 3GS running iOS 4.02 and an iPod Touch running iOS 4.0.
I do not see this crash on an iOS 3.1.3 original iPhone, nor do I see a crash on the emulator.
Thank you for any help.
Is your view controller (or another class) a UIWebViewDelegate for your UIWebView? If so, can you show the code for the delegate methods you implemented?
OK, I solved this myself.
I had a category of NSData in my code that defined the method:
- (NSString*)base64Encoding
Unfortunately, the YouTube plugin in iOS 4 appears to use a hidden method (of a category?) of NSData:
- (NSData*)base64Encoding
Needless to say, my category was overriding this method, causing the problem.

Crash invalidates url for NSPersistentStoreCoordinator

I have a Core Data app that has a bug that causes the app to crash and I have not tracked down its cause yet. One of the results of the crash is that the next time the app is started up it can not open the persistent store used by the application previously. The following error is returned from the addPersistentStoreWithType: method:
NSUnderlyingException = Error validating url for store;
And, of course, it cannot retrieve any of the objects previously stored by the app. Does anyone know what can cause an app to no longer be able to find its persistent store?
The crash that causes the app to shut down prior to all this happening produces the following crash log:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x0007e98c __kill + 8
1 libSystem.B.dylib 0x0007e97c kill + 4
2 libSystem.B.dylib 0x0007e96e raise + 10
3 libSystem.B.dylib 0x0009361a abort + 34
4 libstdc++.6.dylib 0x000453b0 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x00005858 _objc_terminate + 104
6 libstdc++.6.dylib 0x00043776 __cxxabiv1::__terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x000437ca std::terminate() + 10
8 libstdc++.6.dylib 0x00043896 __cxa_throw + 74
9 libobjc.A.dylib 0x00004714 objc_exception_throw + 64
10 Foundation 0x000013c2 __NSThreadPerformPerform + 570
11 CoreFoundation 0x00056a96 CFRunLoopRunSpecific + 1834
12 CoreFoundation 0x00056356 CFRunLoopRunInMode + 42
13 GraphicsServices 0x00003b2c GSEventRunModal + 108
14 GraphicsServices 0x00003bd8 GSEventRun + 56
15 UIKit 0x00002768 -[UIApplication _run] + 384
16 UIKit 0x0000146c UIApplicationMain + 688
17 Meetchu 0x00002568 main (main.m:14)
18 Meetchu 0x0000251c start + 32
I cannot figure out what is happening from this information. Can anyone help with either of these errors?
Many thanks in advance.
If you're storing the actual URL to a file in the app's directory instead of regenerating it each time relative to the app directory, then the invalid URL is the result of the simulator/device changing the name of the app directory to a random UUID. It does that sometimes in response to crashes.
The obvious first step is the log the URL and see if the store is actually at that location.
Drew,
Without seeing some code, I can tell you that one source of agony to me when I first started with Core Data was versioning your models. If you have changed your managed object model in any way, this will cause your app to crash without some versioning (i.e., lightweight) code in place.
This may not be the source of your problem, but one thing you can try is to either remove your app from your iPhone Simulator or use "Reset Contents and Settings" from the iPhone simulator menu. If this fixes the problem, then you're looking at a migrations issue.
Cheers.