Services cannot be added more than once - ios

Using the following code to re-publish my Bluetooth service, I intermittently get a crash with the error message below.
self.stopAdvertising()
peripheralManager.removeAllServices()
if let service = self.cbService {
NSThread.sleepForTimeInterval(0.1)
peripheralManager.addService(service)
self.startAdvertising()
}
2016-06-03 09:32:10.262 BottleSimulator[180:3587] * Assertion failure in -[CBPeripheralManager addService:], /SourceCache/CoreBluetooth/CoreBluetooth-256/CBPeripheralManager.m:307
2016-06-03 09:32:10.270 BottleSimulator[180:3587] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Services cannot be added more than once'
Why am I getting this? I would think that the call to removeAllServices() would protect against this. I even added a sleep for testing, but it didn't stop the intermittent crashes.
Is there a more reliable way to re-publish a service?

Related

Flutter: Firestore transaction crashes only on physical iOS device

I have a simple transaction that updates a Firestore document. It works correctly on Android devices, Android Emulators and iOS emulators, but crashes on a physical iOS device:
Firestore.instance.runTransaction((Transaction tx) async {
DocumentSnapshot docSnapshot = await tx.get(docRef);
tx.update(
docRef,
{
'title':'A Title'
},
);
}
Error:
-[NSError init] called; this results in an invalid NSError instance. It will raise an exception in a future release. Please call
errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:. This
message shown only once.
Assertion failure in void
firebase::firestore::core::Transaction::EnsureCommitNotCalled()(),
/Users/path_to_app/ios/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/transaction.mm:198
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL
ASSERTION FAILED: A transaction object cannot be used after its update
callback has been invoked. (expected !committed_)'
I'm not sure what the error means, and my Google quest has hit a dead-end. Really hoping someone can point out what the problem might be!

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: self.senderId != nil'

I'm playing with JSQMessagesViewController. My first project I did using Raywenderlich's Firebase Tutorial: Real-time Chat tutorial.
Then I created a new project to play more with JSQMessagesViewController. And in this new project I'm having issue now.
After I import JSQMessagesViewController and add it as a super class for my ViewController, I got this error in my console -
Assertion failure in -[NewProject.ViewController viewWillAppear:],
/Users/Downloads/ChatChatFirebaseTutorial-finished/Pods/JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.m:233
2017-05-30 20:43:44.498 NewProject[10688:314277] *** Terminating app
due to uncaught exception 'NSInternalInconsistencyException', reason:
'Invalid parameter not satisfying: self.senderId != nil'
I see message from ChatChatFirebaseTutorial(am I right?) my previous project in my new project.
So, I deleted everything what was about ChatChatFirebaseTutorial and even more from my mac. It didn't help. I uninstalled and installed pods from project and mac few times. It didn't help.
Did anyone has this issue before? If yes, how did you solve it?
The Library requires that you set a senderID for the current user. This can be done by adding a function like this to your class
override func senderId() -> String {
return "UNIQUEID"
}
I would use something you know is going to be unique such as an email or a unique Id you generate just associated to the user so you can determine who sent the messages.

Amazon SNS is crashed with SNSInvalidParameterException in iOS 8?

I have implemented AWS - Simple Notification Service and it was working fine, but after I upgraded my iOS 7 to iOS 8 application is crashed with :
*** Terminating app due to uncaught exception 'AmazonClientException', reason: ''
* First throw call stack:
(0x186f3e084 0x19751c0e4 0x100270224 0x10026f95c 0x1000dd7f0 0x187e0a60c 0x197d3fe80 0x197d3fddc 0x197d3cfb0)
libc++abi.dylib: terminating with uncaught exception of type SNSInvalidParameterException
After execution of below code snippet its crashing,
endPoint.platformApplicationArn = #"arn:aws:sns:eu-west-1:ID:app/APNS_SANDBOX/AppName_Dev";
[amazonClient createPlatformEndpoint:endPoint];
Thank you in advance.
Finally, I've got an solution, this is due to not using same user data for endPoint.customUserData. As Yosuke commented [AmazonLogger verboseLogging]; helped me a lot in tracking the bug.
So try to use same data (as in here #"Test") for one application.
endPoint.customUserData = #"Test";

MZFormSheetController Assertion failure

I'm using Custom AlertView MZFromSheetController, but it gives me the following Exception
*** Assertion failure in -[MZFormSheetController presentAnimated:completionHandler:], /Users/dt4it/Documents/SucessQuotes11/SucessQuotes/MZFormSheetController.m:418
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempting to begin a form sheet transition from to while a transition is already in progress. Wait for didPresentCompletionHandler/didDismissCompletionHandler to know the current transition has completed'
Could anyone tell me how to solve this?
Ensure you aren't calling the presentation method multiple times, I just hit this exact issue and found that the code was being called 4 times. Reducing it down to 1 (as it should be) fixed up the Assertion failure Exception.

Cannot start any Tabris 1.0 application on iOS

Sorry, but I wasn't sure whether to post Tabris questions here or on GitHub, now that 1.0 is available? This is a dup of one I just raised on GitHub...
I've had Tabris 1.0 for a few days now, running ok on browser and Android, but I cannot get the iOS client to start at all. Here is my error in XCode, which is the same whether it is an emulated device or a real iPad:
2013-04-24 09:45:53.616 RapHello[2636:907] * 17 DAY(S) OF TABRIS TRIAL LEFT
2013-04-24 09:45:53.620 RapHello[2636:907] -[AppDelegate clientDidBecomeReady]: unrecognized selector sent to instance 0x1e51fb70
2013-04-24 09:45:53.621 RapHello[2636:907] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate clientDidBecomeReady]: unrecognized selector sent to instance 0x1e51fb70'
* First throw call stack:
(0x343ae3e7 0x3c238963 0x343b1f31 0x343b0737 0x34308208 0x342ff349 0x34c16b7f 0x361c3d11 0x36215b7d 0x361bdd1f 0x361bd7ad 0x361bd1ef 0x37eb15f7 0x37eb1227 0x343833e7 0x3438338b 0x3438220f 0x342f523d 0x342f50c9 0x3621446d 0x362112b9 0xb7981 0xb7908)
libc++abi.dylib: terminate called throwing an exception
This happens quite early on. I see the TABRIS logo screen on the device, but then this crash and nothing else happens.
Any ideas what I'm doing wrong - obviously something quite basic.
Thanks, John
To fix that problem you need to add the following method to your AppDelegate.m :
- (void)clientDidBecomeReady {
/*
Called when the Tabris client did become ready and will start a new session.
*/
}
We will fix this in our trial download asap.

Resources