appcelerator iOS application error with geolocation module - ios

We are developing app for iOS and Android and we are using Ti.Gelocation to getCurrentPosition and then set the Region of the MapView of ti.map module.
The app is already on marketplace and downloaded, so we are developing an important upgrade with this new feature. We dont't have problem with Android platform, but with iOS version of the app we get a several error invoking Ti.Geolocation module
The error on iOS 9.x on iPad and iPhone (we have no test on iPod) is:
-[__NSCFString containsObject:] unrecognized selector sent to instance 0x1463d500 at GeoView.js (line xxxx)
This error happens with the project with it.vocami.vocamiapp app-id, in the test project (ap-id=it.vocami.vocamitest) that we use for research and test of new features, no error happens and all run good. When we add at every level of our code (in the first row too), for example, Ti.Geolocation.locationServiceEnabled, in the main vocamiapp project, we get the error.
We have tried all we could think but at the end, if we change the app-id, the code runs otherwise we get the error. We cannot change the app-id because we need to update our published app.
We are developing with AppceleratorStudio version 4.5.0.021602170281 and Ti SDK ver 5.2.0GA on Mac OS X 10.10.5.

I just recently was "hit" by the fact that when I made my app ready for Google Play I use a specific key/user to sign it with. That behaves differently from just running it locally on the phone.
I had to make sure that I had registered two certificates with Google's API in the developer console. It didn't give me exactly the message that you show - but wouldn't show the map with a location. And the way I read the location prior to showing it on the map led me in the wrong direction looking at permissions on Android first :-)
/John

Related

How can we automate already installed ios app on device using robot framework?

There are 2 main questions that I have.
We are currently having macbook with OS X (10.9.5), it is old indeed, but will it possible to use robot+appium+etc... with this OS? Compatible XCode app is v6.2 on this one. What I read on internet there's no actual information on which versions that works well.
We want to automate an internal app that is already installed on iphone (OS 10.3.3), is this possible to automate by knowing its bundleid? One of the parameter for open application is app (fill in the location). Can we disregard this value?
If anyone can pin point me to the possible answer, it would be really great.
your first question answer : i don't think MAC OSX version would be a problem for you, especially when you have a compatible Xcode app
Second question :
You can automate any app installed in phone (ios/android) with the information of desired capabilities. Here is a sample code to open an installed app in ios
*** Settings ***
Library AppiumLibrary #you need to install this
*** Variables ***
${APPIUM_SERVER1} http://0.0.0.0:4723/wd/hub
${APPIUM_SERVER2} http://0.0.0.0:4750/wd/hub
${app} com.apple.mobilephone #find package name of your app
${version} version=9.3
${platform} iOS
${deviceName} ${destdevice}
${udid} 81eddea4d7f5cea5b5da65b999369b52
${platformName} iOS
${name} My First Mobile Test
${automationName} XCUITest
${xcodeOrgId} 89E87VX
${xcodeSigningId} iPhone
${usePrebuiltWDA} True
*** Keywords ***
setup and open ios app
${iosdriver}= Open Application ${APPIUM_SERVER2} app=${app} version=${version} platform=${platform} deviceName=${deviceName} udid=${udid} platformName=${platformName} newCommandTimeout=2500
... name=${name} automationName=${automationName} xcodeOrgId=${xcodeOrgId} xcodeSigningId=${xcodeSigningId} usePrebuiltWDA=${usePrebuiltWDA}
Set Suite Variable ${iosdriver}
${app} is the desired capability where you provide package name, for more detail you can search how to find package name of ios apps.

"[Crashlytics:Crash] Reporting is disabled"

I am getting the following error messages when our production iOS app initializes:
[Crashlytics] Version 3.8.4 (121)
[Crashlytics] Running on iOS Simulator (iPhone), 10.3.0 (16E195)
[Crashlytics:Crash] Reporting is disabled
[Crashlytics] Crash reporting could not be initialized
[Answers] Initialized
[Fabric] Initialized with kit versions: {
"com.twitter.answers.ios" = "1.3.4";
"com.twitter.crashlytics.ios" = "3.8.4";
"io.fabric.sdk.ios" = "1.6.11";
}
Every subsequent call to log an event gets the following error:
[Crashlytics:Crash] WARNING: CLSLog has been used before (or concurrently with)
Crashlytics initialization and cannot be recorded. The message was: ...
The non-production versions of the app work fine running the exact same code but with different bundleIDs. Normally when the app initializes for the first time, then I see the app populate in the Fabric dashboard, but in this case the app is not showing up.
We have an Android and an iOS version of the app, and they both use the same bundleID, so I am wondering if there is a conflict because of that? I see the Android version of the app in the dashboard, and it seems to be working properly. This is an app that originally was a Xamarin app that compiled to both platforms, neither of which incorporated Fabric/Crashlytics. We have now written native apps on each platform, and both are using Fabric/Crashlytics.
Since this is a pre-existing app in both stores, we do not have the option of changing either app’s bundleID.
Make sure you initialize Crashlytics with Fabric before calling any Crashlytics methods:
Fabric.with([Crashlytics.self])
One step I routinely miss is to make sure you've added the build phase on your target:
"${PODS_ROOT}/Fabric/run" ${FABRIC_API_KEY} ${FABRIC_BUILD_SECRET}
and either replace ${FABRIC_API_KEY} and ${FABRIC_BUILD_SECRET} with your key and secret or add custom build settings for each.
There are apparently cases where Crashlytics does not auto-activate new apps so that they show up under your list of apps, even though everything is coded correctly and data is going to their servers. In this case, send an email to Crashlytics support (support#fabric.io) that contains a copy of the info.plist entries for the app in question and they will activate it for you. I have had to do this several times, especially with app extensions.
When I finally traced it down in my situation, the error was entirely correct, but not obvious.
I saw these errors in various testing targets where the code we tested was using a custom logging wrapper which called CLSNSLogv(), but the test didn't actually go through the AppDelegate and therefore did NOT initialize Crashlytics. After trying a few things I was convinced that it worked when executed as an app, but in our configuration it was not working under the unit test configuration.
I'll likely alter our custom wrapper to bypass CLSNSLogv() during testing anyway. The biggest benefit of using that is when crashes occur on devices, so we won't be missing anything.

Xamarin.UITests - testing on real device - iOS - app permissions popups issue

I've iOS app that needs some privileges (GPS, Push notifications).
When app starts for a first time iOS asks user if they're ok with granting those permissions to application.
I've written some UITests and want to automate running them on locally connected iPhone.
The problem is that I cannot override permissions questions and my tests fails.
I found out that application deployed by IDE (Xamarin Studio) will ask for permissions, but application deployed via UITests will not.
So I tried with .AppBundle(path_to_app) but it says this is only valid for deploying to Simulator.
SetUp : System.Exception : This app bundle is not valid for running on
a simulator. To fix this issue please ensure that your target device
is a simulator. DTPlatformName is 'iphoneos', not 'iphonesimulator' in
the apps Info.plist.
Like it's trying to deploy iPhone app to Simulator. But Target in Xamarin Studio is set to real device.
I tried to add .DeviceIdentifier. When Used with .InstalledApp it was starting up (still asking for permissions).
But when I used DeviceIdentifier and AppBundle there was the same error as above.
My tests works fine on Test Cloud. They work fine on Simulator.
They work fine when I deploy to device manually, start app and approve permissions then run UI tests.
What I cannot achieve is to make UITests override permissions questions on real device.
Anyone made this work?
Last thing is that I found is in documentation for AppBundle method
"Will force a run on simulator"
https://developer.xamarin.com/api/member/Xamarin.UITest.Configuration.iOSAppConfigurator.AppBundle/p/System.String/
So I may be doomed with the task but maybe someone knows a workaround?
You can dismiss system dialogs with UITest by using InvokeUIA. The test below works by tapping the "OK" button of an iOS system alert:
[Test]
public void AppLaunches ()
{
app.Screenshot ("First screen.");
app.InvokeUia ("uia.query('[:view {:marked \"OK\"}]')");
app.InvokeUia ("uia.tapMark(\"OK\")");
}
A working sample app & UITest is also here:
https://github.com/King-of-Spades/InvokeUia-for-System-Dialogs
Warning about system dialogs in Test Cloud
The reason that you don't see this issue in Test Cloud is because Test Cloud automatically dismisses the system alerts; so usually you don't have to worry about it. However, if your alert launches too soon; so that it appears before the automation has fully started your app, then it will be unable to detect & dismiss the alert and cause your test to fail.
So you want to make sure that when running your app in Test Cloud that the request for permissions are delayed, or you can even deactivate them if they aren't explicitly needed for a particular test. More information is available in this Calabash guide: https://github.com/calabash/calabash-ios/wiki/Managing-Privacy-Alerts%3A--Location-Services%2C-APNS%2C-Contacts
(Even though it's Calabash, you can use the same strategy in UITest; albeit with a C# syntax.)
Update for Xcode 8 / iOS 10
Xcode 8 / iOS 10 removed UIAutomation, so the InvokeUIA workaround will only continue to be possible if you're using Xcode 7 and iOS 7-9. References:
UITest: https://developer.xamarin.com/guides/testcloud/UITest/xcode7/
Calabash: https://developer.xamarin.com/guides/testcloud/calabash/xcode7/#Automation_API
For real devices you dont need any of those.
{
app = ConfigureApp
.iOSAppBundle
.StartApp();
}
this piece of code is good enough, if you are connecting real device to the system, then select that before running.
We use this to execute the UI tests on iPhones:
ConfigureApp.iOS.InstalledApp("com.appcenter.UITestDemo").StartApp();
InstalledApp requires you to build an IPA using the Debug
configuration & a valid provisioning profile, and preinstalling it on
the target device.
https://github.com/microsoft/appcenter-Xamarin.UITest-Demo/blob/main/UITestDemo.UITest/AppInitializer.cs
To confirm system dialogs we use this:
private Query ConfirmLocalNetworkPermissionDialogButton
=> AppInitializer.Platform == Platform.iOS
? new Query(x => x.ClassFull("_UIAlertControllerActionView").Marked("OK"))
: x => x.Class("AppCompatButton").Marked("button1");

iOS app cannot connect to MobileFirst server

i created an hybrid application that should connect to the MFP and consume data.
When i try to connect to the Desktop Browser Application everything is fine and the app works. Same behaviour when i try the Mobile Web Application. BUT when i try to connect with the mobile native iOS application i could not connect and receive the following error (in the console):
2015-11-12 17:22:15.031 APPXYZ[6072:3089110] [FATAL] [NONE] Uncaught Exception: TypeError: WLJSX.Ajax.WLRequest.setConnected is not a function. (In 'WLJSX.Ajax.WLRequest.setConnected(false)', 'WLJSX.Ajax.WLRequest.setConnected' is undefined) at (compiled_code):3871
My specs:
MFP version 7.1.0.00.20151107-1653
Xcode 7.1.1
iOS deploy target 8.0
Transport security protocol is deactivated (Allow Arbitrary Loads -> YES)
I cannot confirm this claim.
Using the following, I create a blank new Hybrid app with the iPhone environment, that calls the WL.Client.connect method in wlCommonInit() and displays an alert with "success" or "failure" accordingly. I got "success". No errors in the Xcode Console.
Xcode 7.1.1
IBM MobileFirst Platform Studio 7.1.0.00-20151107-1647
If you are doing something different in your project, do let us know...
The solution of my problem was that i change the init calling sequence of my app. I called the wl specific functions to early. After changing the sequence my app runs perfectly.....
thx 4 help :)

IBM Worklight Application Center iOS unresponsive to touch events

After successfully building and deploying the IBMAppCenter project, when attempting to download the IBM Application Center on iOS devices, there is no response when clicking on the actual installer link. This occurs on both real devices and through the simulator. Android application seems to be working just fine. I've provided a picture here showing some of the errors messages that we're seeing when clicking on 'IBM App Center iOS', as well as provided a subset of them below (http://i.imgur.com/vLrhVjT.jpg):
Deprecated attempt to access property 'changedTouches' on a non-TouchEvent object.
Deprecated attempt to access property 'target' on a non-Event object.
TypeError: undefined is not an object (evaluating 'a.target.getAttribute')
...
Deprecated attempt to access property 'which' on a non-UIEvent object.
App Center Console version 6.2.0.00-20140613-0730
IBM Worklight Studio version 6.2.0.1
Any idea what may be causing this, and how we can correct it? Thanks!
Make sure you are using a recent iFix of Worklight 6.2.0.x containing required Dojo fixes in order to add support for iOS 8 (which you are likely attempting to use the app on).
You can review the following tech note for instructions on downloading and installing the iFix: http://www-01.ibm.com/support/docview.wss?uid=swg21684538

Resources