XMPPTCPConnectionConfiguration initialization fails - smack

Here is the source code that I'm using to initialize it in an Android app but it never returns and the app crashes. Has anyone else tried this out? This is smack 4.1 beta.
XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
.setCompressionEnabled(false)
.setSecurityMode(ConnectionConfiguration.SecurityMode.required)
.setRosterLoadedAtLogin(true)
.setKeystorePath("/system/etc/security/cacerts.bks")
.setKeystoreType("bks")
.setSendPresence(false)
.build();

Related

configure firebase with options is crashing in Xcode 11 and Firebase 6.19

I'm trying to register a second firebase application in my app. The first one is correctly registered inside didFinishWithLaunchingWithOptions method (by default is using the GoogleService-Info.plist)
FirebaseApp.configure()
Then I need to retrieve a new googleAppId from a server and configure a new application using this new googleAppId and using my iOSID of curse. I am doing all this registration inside AppDelegate. I'm registering this way:
let options = FirebaseOptions(googleAppID: String(format: "1:%a:ios:%a", googleID, iOSID), gcmSenderID: googleID)
//Deleting the first app in order to register the second
let app = FirebaseApp.app()
app?.delete { _ in }
FirebaseApp.configure(options: options)
It was working well until I update my firebase version from 6.2 to 6.19, now the app is crashing in FirebaseApp.configure(options: options)
The log says:
Terminating app due to uncaught exception 'com.firebase.installations', reason
'[Firebase/Installations][I-FIS008000] Could not confiure Firebase Installations die to invalid
Firebase options. The following parameters are nil or empty: `FirebaseOptions.APIKEY`. If you
use GoogleServices-Info.plist please download the most recent version from the Firebase Console.
If you configure Firebase in code, please make sure you specify all required paramaters.
Is worth mencioning that a new Framework was added to Analytics in Firebase version 6.15 so I had to added it in order to make my app compile again.
I also tried to add a new parameter inside the FirebaseOptions but is still asking for the same parameters, it is not expecting an APIKEY which i don't know where to get it
The message comes from here as far as I can see. The check done there shows that these three values must always be specified:
if (appName.length < 1) {
[missingFields addObject:#"`FirebaseApp.name`"];
}
if (appOptions.APIKey.length < 1) {
[missingFields addObject:#"`FirebaseOptions.APIKey`"];
}
if (appOptions.googleAppID.length < 1) {
[missingFields addObject:#"`FirebaseOptions.googleAppID`"];
}
From the error message and your code it looks like you're not specifying the APIKEY in your FirebaseOptions, which is required according to the SDK.

Firebase childbyAutoId returns the same strange key every time

When using childByAutoId, something really strange happens. Instead of getting a unique id, I get the following key every time:
-------------------0
I know keys are generated with client side timestamps, so I tried running my code through the iOS simulator and an actual device, same result though.
I don't do anything interesting in my code, but here it is for reference:
func sendRandomMessage() {
let firebaseRootRef = Firebase(url:firebaseRootUrl)
let newMessageRef = firebaseRootRef.childByAutoId()
println(newMessageRef.key)
}
I'm using Firebase 2.3.0
There was a bug in the Firebase SDK for iOS 2.3.0 that caused this problem.
It has been fixed in 2.3.1. See https://www.firebase.com/docs/ios/changelog.html

App used to work with AIR 3.2, doesn't work with AIR 3.5

I'm getting this error when I press a button in a flash/air app that used to work in the AIR 3.2 SDK - now upgraded to the AIR 3.5 SDK. Any help much appreciated.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at seed_template_fla::MainTimeline/frame7()[seed_template_fla.MainTimeline::frame7:31]
at flash.display::MovieClip/gotoAndPlay()
at seed_template_fla::MainTimeline/gotoPage() [seed_template_fla.MainTimeline::frame1:20]
at seed_template_fla::MainTimeline/gotoRepro() [seed_template_fla.MainTimeline::frame1:12]
I'm creating an app for iPhone using Flash CS6 on Mac and exporting using the Air 3.5 SDK. I also have the AIR 3.5 runtime installed.
The app is very simple at the moment. It basically moves from frame to frame when you press a button using the gotoAndPlay(frameNr) function. There are some hexes on the frames that update an array of numbers when clicked. They are also toggled visible/not visible.
This used to work perfectly using the AIR 3.2 SDK, but I recently downloaded the AIR 3.5 SDK from adobe and added it through flash (Help>Manage Air SDK) and set it as the build target in File>Publish Settings>Target.
When I switch back to AIR 3.2 SDK, the app works perfectly again.
Also, when I upload the app to my iPhone 4S running IOS 5.1 using AIR 3.5 SDK, I just see a black screen with 5 loading dots flashing. This also works fine with AIR 3.2 SDK.
This is the code for frame 7
The last line is line 31.
stop();
techtitle.text = "Select Trait";
techdesc.text = "Spend points to change core stats and other special abilities";
points.visible = false;
techpoints.visible=false;
pointsbalance.text = myPoints.toString();
btn_tech.visible = false;
curTechSelected = null;
trace("set hexes invisible");
for (var j:int = 0; j <= 67; j++) {
if (hexStatusb[j] == 1) {
this["btn_hex_"+j+"b"].visible = false;
}
}
function onBtnHex37bClick(event:MouseEvent):void
{
techtitle.text = "tech1";
techdesc.text = "tech1 description"
techpoints.text = "-2";
points.visible = true;
techpoints.visible=true;
btn_tech.visible = true;
curTechSelected = btn_hex_37b;
curTechSelectedNr = 37;
curTechPoints = 2;
}
trace(this["btn_hex_37b"]);
btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);
OK - so, after trying out lots of things, I figured out why this is happening.
Solution: get rid of all TFL text objects when running AIR 3.5 SDK
It seems that the TFL Text library wasn't being loaded properly at runtime. Something crucial that I neglected to mention was that I was getting this warning message (similar here http://forums.adobe.com/thread/825637)
Content will not stream... The runtime shared libraries being preloaded are textLayout_1.0.0.05... TFLText
and this warning message in the output
Warning: Ignoring 'secure' attribute in policy file from http://fpdownload.adobe.com/pub/swz/crossdomain.xml. The 'secure' attribute is only permitted in HTTPS and socket policy files.
Simply removing all TFLText objects and changing them to classic text makes the app work fine again.
#csomakk Great news. I have found the answer. You can publish in 3.5 and 3.6 and have your TLF Text too. I posted a write-up on my blog that shows exactly how to do it.
To get started: the error message states that something is null.. it means, that the program doesn't know, where to look for it. It can happen, when you didn't create the object (btn_hex_37b = new MovieClip()); or you haven't even created a variable for it.
on the given line (btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);) only btn_hex_37b can be null, because onBtnHex37bClick exists, and if it wouldn't, the program wouldn't compile.
The reason it came up when switching to AIR 3.5 is probably that it calls some creation functions in different order. Go to the line where you define the btn_hex_37b variable. Search for that functions calling.. Make sure, that btn_hex_37b is created before going to frame7.
Also, if its not a vital, to have onBtn_hex_37bClick, you can do the following:
if(btn_hex_37b){
btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);
}
the if will check if btn_hex_37b is not null.
On the else method, you can give a timeouted method(but that is ugly), or give the eventlistener right after the creation of the object.
Hope this helped.
For Flash CS6, copy this swc:
/Applications/Adobe Flash CS6/Common/Configuration/ActionScript 3.0/libs/flash.swc
Into my Flash Builder project using these steps:
http://interactivesection.files.wordpress.com/2009/06/include_fl_packages_in_flex_builder-1.jpg
and then use this link
http://curtismorley.com/2013/03/05/app-used-to-work-with-air-3-2-or-3-4-doesnt-work-with-air-3-5-or-3-6/#comment-241102

Phonegap ContactError when saving contact on iOS 6

I have this posted on PhoneGap google groups and cross-posted it here on Stack Overflow.
Anyway, PhoneGap's Contact API is giving me headache lately. To cut it short:
Environment
iOS 6
PhoneGap 2.0.0
I have this application that scans a QR code with VCard embeded, and it will save it into user's contact once the user agree to save it down. On Android 4.1.2, this piece of code works flawlessly without any error, and contact was saved too. On iOS 6, however, I can't get it to work. What I have always receive is error #4, which is, ContactError.IO_ERROR.
The code is as below:
navigator.notification.confirm('Found a contact: "'+(vcard['N'] || '')+'". Add it into your contact list?', function(btn) {
if (btn == 1) {
var contact = navigator.contacts.create();
contact.displayName = vcard['N'] || '';
contact.emails = [new ContactField('email', vcard['EMAIL'] || '')];
var org = new ContactOrganization();
org.name = vcard['ORG'] || '';
contact.organizations = [org];
contact.save(function() {
navigator.notification.alert('Contact Saved');
}, function(err) {
navigator.notification.alert('Error on saving contact: '+err.code);
});
}
}, 'QR Code Scanner', 'OK,Cancel');
And below is the only log I have seen on XCode right after I tap on 'OK': (first callback is for the notification.confirm)
2012-10-22 21:19:24.619 [11897:907] PluginResult:toJSONString - {"status":1,"message":1,"keepCallback":false}
2012-10-22 21:19:24.621 [11897:907] PluginResult toSuccessCallbackString: cordova.callbackSuccess('Notification12',{"status":1,"message":1,"keepCallback":false});
2012-10-22 21:19:24.738 [11897:907] PluginResult:toJSONString - {"status":9,"message":4,"keepCallback":false}
2012-10-22 21:19:24.739 [11897:907] PluginResult toErrorCallbackString: cordova.callbackError('Contacts13',{"status":9,"message":4,"keepCallback":false});
Then I will see the alert:
Error on saving contact: 4
Note
vcard is a key-value pair of vcard obj. Please ignore this for now. It's not important.
This piece of code works fine on android.
Is this the correct way of creating contact? How can you save a contact on iOS 6 using PhoneGap?
Edit
I did all the necessary migration and upgraded to v2.1.0, but the error code still emerges. Why is this?
Edit
Apparently this has something to do with the new AddressBook permissions request on iOS 6 as mentioned by Mark, but no one has answered me on how to do it properly. Spent some times on research I came to a conclusion that it's best if we can just wait for Phonegap to finish up v2.2 as I saw permission request being added in CDVContacts.m in v2.2 rc2 commit 61857860...
https://issues.apache.org/jira/browse/CB-902
Currently crashes if the user does not have AddressBook permission on iOS 6.
The user will get a popup dialog similar to the Geolocation permissions dialog. When creating an address book, we should handle the condition where the app does not have permission, and the address book returned is NULL.
i've had the same problem. As it turns out, i was using phonegap version 1.9, which did not support iOS 6, therefore adding a contact gave me Error 4 message all the time. To fix this, i upgraded to phonegap version 2.1. This version supports iOS 6 as well as both armv6 and armv7 architectures. The error message was because iOS 6 requires permissions to access the address book, in the same way that using the GPS requires permission on iOS. This should solve your problem, it did for me :)

about blackberry development

I started in blackberry development.
Currently, I try to develop App with:
Blackberry Widget API (Javascript + CSS) and Eclipse (JAVA)
1/
When I try with Blackberry Widget API, I try to load a webservice in .NET, I try to run this in simulator 8520 curve... and the connect to the webservice not works, I use the config.xml to set the domains but nothing happends, later I test in 9800 simulator and works fine... but I have some fear because this app is for run in any device :(
2/
When I try with Eclipse and kSOAP2 Library,
This is my code:
String WSD_URL = "http://service.com/service.asmx";
String WSD_NAMESPACE = "http://service.com/GetInfo";
String WSD_ACTION = "http://service.com/GetInfo/fGetInfo";
SoapObject soap = new SoapObject(WSD_NAMESPACE, "fGetInfo");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.bodyOut = soap;
envelope.encodingStyle = SoapEnvelope.XSD;
HttpTransport ht = new HttpTransport(WSD_URL);
try {
ht.call(WSD_ACTION, envelope);
} catch (Exception e){
}
When I launch the app in simulator... nothing happend, few minutos after I see a error in the white screen with message "controlled access exception" :(
I have doubt here because I dont know how to solve this and if this app run in any devive.
In eclipse I see JRE 6.0
To access dot net webservice, instead of Ksoap method, try this one.. http://whatpaulhaslearnt.wordpress.com/2011/04/19/consuming-a-net-web-service-from-a-blackberry-native-application-using-the-java-me-platform-sdk-3/ .. this is the best way of accessing dot net webservice..

Resources