Linking Api's openURL with schema tel error in iPad - ipad

I am using the following code...
openPhoneDialler(mobile) {
let url = 'tel:' + mobile;
Linking.canOpenURL(url).then(supported => {
if (!supported) {
throw 'Cant open phone dialler';
} else {
return Linking.openURL(url);
}
}).catch(err =>
Alert.alert('Error','Error occurred',[{text: 'OK', onPress: () => {}}])
);
}
I am testing on an iPad without SIM card feature (Wifi only) , the canOpenURL gets resolved and the Linking.openURL(url) is called which shows an Alert with the mobile number and two options 'Cancel' and 'Call'. When I press 'Call' the alert gets closed and nothing happens which is expected since it is Wifi only iPad.
But when I press 'Cancel' the app crashes with the following error screen
JSON value '{
code = EUNSPECIFIED;
domain = RCTErrorDomain;
framesToPop = 1;
nativeStackIOS = (
"0 workforce_mobile 0x00000001000d4d00 RCTJSErrorFromCodeMessageAndNSError + 152",
"1 workforce_mobile 0x0000000100053e4c __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.224 + 192",
"2 workforce_mobile 0x000000010015e2f0 -[RCTLinkingManager openURL:resolve:reject:] + 352",
"3 CoreFoundation 0x000000018164ce80 <redacted> + 144",
"4 CoreFoundation 0x00000001815422b4 <redacted> + 292",
"5 CoreFoundation 0x0000000181546e7c <redacted> + 60",
"6 workforce_mobile 0x0000000100055098 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1704",
"7 workforce_mobile 0x00000001000aea54 -[RCTBatchedBridge callNativeModule:method:params:] + 568",
"8 workforce_mobile 0x00000001000addf4 __33-[RCTBatchedBridge handleBuffer:]_block_invoke.477 + 1276",
"9 libdispatch.dylib 0x00000001804fe9e0 <redacted> + 24",
"10 libdispatch.dylib 0x00000001804fe9a0 <redacted> + 16",
"11 libdispatch.dylib 0x000000018050cad4 <redacted> + 928",
"12 libdispatch.dylib 0x00000001805022cc <redacted> + 884",
"13 libdispatch.dylib 0x000000018050ea50 <redacted> + 540",
"14 libdispatch.dylib 0x000000018050e7d0 <redacted> + 124",
"15 libsystem_pthread.dylib 0x00000001807071d0 _pthread_wqthread + 1096",
"16 libsystem_pthread.dylib 0x0000000180706d7c start_wqthread + 4"
);
userInfo = "<null>";
}' of type NSDictionary cannot be converted to NSString
Note: the same crash also happens when u leave the alert open for around 10 seconds without any press.
Tested on : iPad (Wifi only and physical device) OS version 10.3.1
Is this a bug in React-Native Linking Api or with the above code.

Linking.openUrl returns a promise object. By pressing the Cancel button, you cause the promise to be rejected. Just add a catch to swallow the rejected promise.
Linking.openUrl().catch(() => null)
Here's the documentation about that:
https://facebook.github.io/react-native/docs/linking.html#openurl

Related

React Native Sound: AAC files are not played on IOS (OSStatus error 2003334207.)

I'm currently trying to play .aac audio files using the react-native-sound library. Same file works on Android with the same code. Additionally I've also tried the converted version of the audio file to .wav and this also works. Any idea what I should look for?
Raw Error:
{"code": "ENSOSSTATUSERRORDOMAIN2003334207", "domain": "NSOSStatusErrorDomain", "message": "The operation couldn’t be completed. (OSStatus error 2003334207.)", "nativeStackIOS": ["0 Biped 0x00000001016cdfbc RCTJSErrorFromCodeMessageAndNSError + 112", "1 Biped 0x00000001016cdf0c RCTJSErrorFromNSError + 236", "2 Biped 0x00000001015db688 -[RNSound prepare:withKey:withOptions:withCallback:] + 1280", "3 CoreFoundation 0x0000000180412840 __invoking___ + 144", "4 CoreFoundation 0x000000018040fa24 -[NSInvocation invoke] + 276", "5 CoreFoundation 0x000000018040fcbc -[NSInvocation invokeWithTarget:] + 60", "6 Biped 0x000000010166d9d4 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1744", "7 Biped 0x00000001016712ec _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1108", "8 Biped 0x0000000101670cbc _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144", "9 Biped 0x0000000101670c20 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28", "10 libdispatch.dylib 0x0000000180133fa4 _dispatch_call_block_and_release + 24", "11 libdispatch.dylib 0x0000000180135768 _dispatch_client_callout + 16", "12 libdispatch.dylib 0x000000018013d7f8 _dispatch_lane_serial_drain + 780", "13 libdispatch.dylib 0x000000018013e43c _dispatch_lane_invoke + 392", "14 libdispatch.dylib 0x000000018014a624 _dispatch_workloop_worker_thread + 772", "15 libsystem_pthread.dylib 0x00000001ae55eb40 _pthread_wqthread + 284", "16 libsystem_pthread.dylib 0x00000001ae55d904 start_wqthread + 8"], "userInfo": {}}

react-native-share error ENSCOCOAERRORDOMAIN3072 on Save to File in iOS

I'm developing a react-native application, I use import Share from 'react-native-share'; for sharing files.
When it open share modal on iOS and I choose Save to File ( for examples a pdf file ) it thrown this execption:
{
"code": "ENSCOCOAERRORDOMAIN3072",
"message": "The operation was cancelled.",
"nativeStackIOS": [
"0 MyApp 0x0000000109361a97 RCTJSErrorFromCodeMessageAndNSError + 135",
"1 MyApp 0x00000001093619c3 RCTJSErrorFromNSError + 275",
"2 MyApp 0x00000001092e8c81 __41-[RCTModuleMethod processMethodSignature]_block_invoke_4.110 + 161",
"3 MyApp 0x0000000109242696 __48-[RNShare open:failureCallback:successCallback:]_block_invoke_2 + 214",
"4 ShareSheet 0x00007fff4310eec7 __68-[UIActivityViewController _cleanupActivityWithSuccess:items:error:]_block_invoke + 183",
"5 UIKitCore 0x00007fff46e15f25 -[UIPresentationController transitionDidFinish:] + 978",
"6 UIKitCore 0x00007fff46e1aa61 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.503 + 199",
"7 UIKitCore 0x00007fff46f32e2c -[_UIViewControllerTransitionContext completeTransition:] + 88",
"8 UIKitCore 0x00007fff47a0c180 -[UITransitionView notifyDidCompleteTransition:] + 247",
"9 UIKitCore 0x00007fff47a0be03 -[UITransitionView _didCompleteTransition:] + 1423",
"10 UIKitCore 0x00007fff47a45f20 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 671",
"11 UIKitCore 0x00007fff47a16a11 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 268",
"12 UIKitCore 0x00007fff47a16f83 -[UIViewAnimationState animationDidStop:finished:] + 259",
"13 UIKitCore 0x00007fff47a1710a -[UIViewAnimationState animationDidStop:finished:] + 650",
"14 QuartzCore 0x00007fff2b080ac2 _ZN2CA5Layer23run_animation_callbacksEPv + 306",
"15 libdispatch.dylib 0x00007fff516ad781 _dispatch_client_callout + 8",
"16 libdispatch.dylib 0x00007fff516b9caa _dispatch_main_queue_callback_4CF + 1212",
"17 CoreFoundation 0x00007fff23b0ce49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9",
"18 CoreFoundation 0x00007fff23b07aa9 __CFRunLoopRun + 2329",
"19 CoreFoundation 0x00007fff23b06e66 CFRunLoopRunSpecific + 438",
"20 GraphicsServices 0x00007fff38346bb0 GSEventRunModal + 65",
"21 UIKitCore 0x00007fff47578dd0 UIApplicationMain + 1621",
"22 MyApp 0x0000000109117201 main + 97",
"23 libdyld.dylib 0x00007fff516ecd29 start + 1",
"24 ??? 0x0000000000000001 0x0 + 1"
],
"domain": "NSCocoaErrorDomain",
"userInfo": {}
}

Cannot enable Health Records capabilities in Xcode

I'm setting up HealthKit as the official manual says to read user's Health records. I enabled it and passed all the three steps to make it work, but somehow the "Health Records" capability is disabled and I cannot check it. As the result, the app crashes saying it cannot authenticate a request to health records.
How can I enable it?
Xcode Version 10.0 beta 6 (10L232m) with iOS 12 SDK.
There is also an entitlement file:
Account settings:
My code:
RCT_EXPORT_METHOD(requestAccess:(RCTResponseSenderBlock)callback) {
NSNull * null = [NSNull null];
NSSet * recordTypes = [self recordTypes];
HKHealthStore *store = [HKHealthStore new];
[store requestAuthorizationToShareTypes:nil
readTypes:recordTypes
completion:^void (BOOL success, NSError * _Nullable error) {
if (success) {
callback(#[null, #true]);
Crash report
Exception 'Authorization to read the following types is disallowed: HKClinicalTypeIdentifierMedicationRecord' was thrown while invoking requestAccess on target AppHealthRecords with params (
259
)
callstack: (
0 CoreFoundation 0x000000010709429b __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000105777735 objc_exception_throw + 48
2 CoreFoundation 0x00000001070940f5 +[NSException raise:format:] + 197
3 HealthKit 0x0000000104dc7ec0 -[HKHealthStore _throwIfAuthorizationDisallowedForSharing:types:] + 540
4 HealthKit 0x0000000104dc6912 -[HKHealthStore _validateAuthorizationRequestWithShareTypes:readTypes:] + 224
5 HealthKit 0x0000000104dc6a82 -[HKHealthStore requestAuthorizationToShareTypes:readTypes:shouldPrompt:completion:] + 321
6 HealthKit 0x0000000104dc680f -[HKHealthStore requestAuthorizationToShareTypes:readTypes:completion:] + 77
7 app 0x0000000104574c43 -[AppHealthRecords requestAccess:] + 307
8 CoreFoundation 0x000000010709b11c __invoking___ + 140
9 CoreFoundation 0x00000001070985b5 -[NSInvocation invoke] + 325
10 CoreFoundation 0x0000000107098a06 -[NSInvocation invokeWithTarget:] + 54
11 app 0x000000010461ec6a -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2810
12 app 0x00000001046d5dd6 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 790
13 app 0x00000001046d58ef _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127
14 app 0x00000001046d5869 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
15 libdispatch.dylib 0x00000001099c251d _dispatch_call_block_and_release + 12
16 libdispatch.dylib 0x00000001099c3587 _dispatch_client_callout + 8
17 libdispatch.dylib 0x00000001099ca058 _dispatch_lane_serial_drain + 720
18 libdispatch.dylib 0x00000001099cab9b _dispatch_lane_invoke + 401
19 libdispatch.dylib 0x00000001099d39c6 _dispatch_workloop_worker_thread + 645
20 libsystem_pthread.dylib 0x0000000109d48fd2 _pthread_wqthread + 980
21 libsystem_pthread.dylib 0x0000000109d48be9 start_wqthread + 13
)
You need to add the Health Records key to your entitlements file.
And make sure to add an entry for the NSHealthClinicalHealthRecordsShareUsageDescription key in Info.plist
Entitlements screenshot:
You need to attach your project with a developer account to be able to switch on Health Records

App crash when I my app in background and locked

I use the method bellow:
[filehandler writeData:[NSData dataWithBytesNoCopy:bytes length:size freeWhenDone:NO]];
filehandler is NSFileHandle, when my phone locked the value after some seconds arrive Null and my app crash.
Here is the crash message _:
[EXCEPTION] *** Terminating app due to uncaught exception 'NSFileHandleOperationException', reason: '*** -[NSConcreteFileHandle writeData:]: Operation not permitted'
*** Fragment of the call stack:
(
"4 libc++abi.dylib 0x1a6c398f <redacted> + 78",
"5 libc++abi.dylib 0x1a6c31a3 <redacted> + 0",
"6 libobjc.A.dylib 0x1a6cf139 <redacted> + 0",
"7 CoreFoundation 0x1b447a85 <redacted> + 0",
"8 Foundation 0x1bd3e1af <redacted> + 144",
"9 Foundation 0x1bd3ea5f <redacted> + 254",
"10 PrivateGSMEnt 0x0014acfb -[LogFileManager level:tagLevel:mainTag:append:] + 1070",
"11 PrivateGSMEnt 0x00067003 log_func + 996",
"12 PrivateGSMEnt 0x0046c451 log_writer + 166",
"13 PrivateGSMEnt 0x003dfb53 pj_log + 1284",
"14 PrivateGSMEnt 0x003dfdf7 pj_log_4 + 64",
"15 PrivateGSMEnt 0x003e0e97 replace_udp_sock + 170",
"16 PrivateGSMEnt 0x003e13f5 ioqueue_dispatch_read_event + 590",
"17 PrivateGSMEnt 0x003e32ef pj_ioqueue_poll + 898",
"18 PrivateGSMEnt 0x003f47d5 worker_proc + 84",
"19 PrivateGSMEnt 0x003de4c7 thread_main + 146",
"20 libsystem_pthread.dylib 0x1accc93b <redacted> + 216",
"21 libsystem_pthread.dylib 0x1accc85d _pthread_start + 234",
"22 libsystem_pthread.dylib 0x1acca468 thread_start + 8"
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Any ideas?

Extend MDM Solution for Mac OS X

We have been developig a MDM server which are to support for iOS as well as Mac OS X. So we were able to enroll iOS devices with our server. Now we are head into Mac OS X implementation. According to this (http://training.apple.com/pdf/wp_osx_configuration_profiles_ml.pdf) some attributes are changed in Plist. When we try to enroll a Mac OS X laptop with our server it does the first four steps which are enroll, profile, GetCACaps and GetCACert.Then unexpected error has been occurred in client side. Here is system.log. What would be the reason ?
Mar 7 12:13:21 --- last message repeated 1 time ---
Mar 7 12:13:21 chamara mdmclient[626]: *** ERROR *** [Agent:503] <: [MDM_SCEP_Enroll] Calling SCEPGetCACert. CA Ident: EnrollmentCAInstance --> <NSOSStatusErrorDomain:-25300>
Mar 7 12:13:21 chamara mdmclient[626]: *** ERROR *** [Agent:503] ExtractOTAIdentity ( <NSOSStatusErrorDomain:-25300>)
Mar 7 12:13:21 chamara mdmclient[626]: *** ERROR *** [Agent:503] ProcessOTABootstrapProfileCore ( <NSOSStatusErrorDomain:-25300>)
Mar 7 12:13:21 chamara WindowServer[95]: _CGXGetWindowOrderingGroup: Operation on a window 0x101 requiring rights 0x5 by caller System Preferences
Mar 7 12:13:21 chamara com.apple.preferences.configurationprofiles.remoteservice[625]: *** ERROR *** [CPInstallerUI:503] Profile installation ( MDM Service (com.mac.mdm.profile-service)) (<NSOSStatusErrorDomain:-25300> The operation couldn’t be completed. (OSStatus error -25300.)
UserInfo: {
CallStackSymbols = (
"0 mdmclient 0x0000000105b6ff0a mdmclient + 20234",
"1 mdmclient 0x0000000105b9a177 mdmclient + 192887",
"2 mdmclient 0x0000000105b7bf97 mdmclient + 69527",
"3 mdmclient 0x0000000105b8b9a7 mdmclient + 133543",
"4 mdmclient 0x0000000105b7e544 mdmclient + 79172",
"5 mdmclient 0x0000000105b8b80d mdmclient + 133133",
"6 mdmclient 0x0000000105b88115 mdmclient + 119061",
"7 libdispatch.dylib 0x00007fff8baa428d _dispatch_client_callout + 8",
"8 libdispatch.dylib 0x00007fff8baab3b0 _dispatch_sync_f_invoke + 39",
"9 mdmclient 0x0000000105b88045 mdmclient + 118853",
"10 mdmclient 0x0000000105b8848d mdmclient + 119949",
"11 libxpc.dylib 0x00007fff917275cc _xpc_connection_call_event_handler + 58",
"12 libxpc.dylib 0x00007fff917261df _xpc_connection_mach_event + 2124",
"13 libdispatch.dylib 0x00007fff8baa7ae2 _dispatch_client_callout4 + 9",
"14 libdispatch.dylib 0x00007fff8baa839c _dispatch_mach_msg_invoke + 143",
"15 libdispatch.dylib 0x00007fff8baa6617 _dispatch_queue_drain + 359",
"16 libdispatch.dylib 0x00007fff8baa7682 _dispatch_mach_invoke + 154",
"17 libdispatch.dylib 0x00007fff8baa5f87 _dispatch_root_queue_drain + 75",
"18 libdispatch.dylib 0x00007fff8baa7177 _dispatch_worker_thread2 + 40",
"19 libsystem_pthread.dylib 0x00007fff8b273ef8 _pthread_wqthread + 314",
"20 libsystem_pthread.dylib 0x00007fff8b276fb9 start_wqthread + 13"
);
IsInternalError = 1;
})
Mar 7 12:13:22 chama

Resources