Ionic iOS build failing with phonegap-plugin-push - ios

I have added the following package info in my package.json under cordovaPlugins array as the plugin documentation says.
{
"variables": {
"SENDER_ID": "XXXXXXX"
},
"locator": "phonegap-plugin-push"
}
However, the iOS build is failing and I'm unable to figure out what's wrong as I'm new to iOS app development. Here's the partial log that shows the error, which majorly says,
'UIRemoteNotificationType' is deprecated: first deprecated in iOS 8.0 - Use UIUserNotificationType for user notifications and registerForRemoteNotifications for receiving remote notifications instead
and more of similar logs talking about UIRemoteNotificationTypeNone, UIRemoteNotificationTypeBadge etcetera.
Can anyone help me out with this?

I played around a little and updated my ionic and cordova CLI's,
also updated ios-deploy library and re-installed iOS platform. Things are working now.
I think ios-deploy was out dated.

Related

why is sqlite plugin not working with cordova app on ios

I am building a cordova app for android and iOS that stores user information in a local database. However, I am unable to open a database connection on iOS.
The app works perfectly on android, but when I run it on iOS I get an error saying that window.sqlite is undefined. I have been searching the internet, but I can't find a related issue. I am not sure if my code has been setup incorrectly, or if I am missing some configuration for iOS. The SQLite plugin I am using "cordova-sqlite-evplus-legacy-free 0.9.1", and the cordova iOS version is "5.0.1".
db = window.sqlitePlugin.openDatabase({
name: 'test.db',
location: 'default',
//iosDatabaseLocation: 'Library'
},
function(db) {
if (clean_database) dumpDatabase();
else buildSchemaVersions();
},
function(error) {
db_error = error;
alert('Open database ERROR: ' + error.message);
})
First of all: I would strongly advise against using a plugin for which the last update has been made more than 2 years ago, especially if it is for something as important as the database of your app. It is very likely that it has not been properly tested on current version of iOS. Why not use the more active plugin cordova-sqlite-storage? I have been using this plugin for years now without any issues whatsoever (iOS and Android).
For the question itself:
Did you make sure to make the openDatabase call after the deviceready event?
Was the plugin correctly added to the iOS platform? Please try removing it and adding it again and look out for any errors when it is added to the iOS platform.

opentok streaming error in Xcode 9.0: OT.Publisher.onStreamAvailableError

I am using opentok in my Hybrid ionic app for live streaming.
I am facing issue that I am unable to see live streaming in ios app, although its working on my android app which is already published on Google Play,
Now I need to publish my ios app but I am stuck with these errors showing in Xcode
"ERROR: OT.Publisher.onStreamAvailableError OT_MEDIA_ERR_ABORTED: Argument 1 ('mediaStream') to webkitAudioContext.createMediaStreamSource must be an instance of MediaStream"
"ERROR: OT.exception :: title: Unable to Publish (1500) msg: GetUserMedia"
Device I am using is iPhone 6 (OS 11.0, Safari 11.0)
I had same problem.
For me, problem was in publisher options for OT.initPublisher.
Option "resolution" was redundant. It crashed everythin for ios only, I commented it -ant everything is ok now. Good luck!
You can use the Cordova OpenTok Plugin to add live video to your Ionic applications:
https://github.com/opentok/cordova-plugin-opentok/
The plugin allows you to publish, subscribe, and use the OpenTok Signaling API on both iOS and Android. For Ionic samples, take a look at the following repo: https://github.com/opentok/opentok-ionic-samples

error: no known class method for selector 'isPedometerEventTrackingAvailable'

I am using Diagnostic plugin to my IOS IONIC 2 app. i am getting an error when i do ionic build ios with production mode (--prod). Could anyone help me how to solve this issue?
Thanks in advance:)
error: no known class method for selector
'isPedometerEventTrackingAvailable'
return [CMPedometer respondsToSelector:#selector(isPedometerEventTrackingAvailable)] &&
[CMPedometer isPedometerEventTrackingAvailable];
Check github issue.
Also here.
Either update your Xcode version to 8.0 or above.
cordova.plugins.diagnostic#3.2.0 adds support for the new
UserNotifications framework added in iOS 10. To build using v3.2.0,
you will need to use XCode 8+ because there's no way to conditionally
include a framework using the tag in the plugin.xml.
Or downgrade your diagnostic plugin to 3.1

How to fetch IOS device token using ionic?

Ionic version 2.0
Cordova version 6.3.1
Xcode 8
Have already tried these two links but it did not help.
http://ngcordova.com/docs/plugins/pushNotifications/
https://github.com/hollyschinsky/PushNotificationSample
Looking for a detailed tutorial/material for fetching device token of IOS using ionic.
http://ngcordova.com/docs/plugins/pushNotifications/
Try this only
I also faced the same problem.
Kindly check the IOS OS version of test device. If it is 10.0 or above please do
appropriate changes in Xcode settings in capabilties section
Allow push notification ( it should be checked).
PFB:
Push Notification is not working on iOS 10
you have to use this plugin
if ( device.platform == 'iOS'){
pushNotification.register(
tokenHandler,
errorHandler,
{
"badge":"true",
"sound":"true",
"alert":"true",
"ecb":"onNotificationAPN"
});
}
}
Write this after the device ready event.
function errorHandler(error) {
alert(error);
}
This is the error callback function.
function tokenHandler(result){
// Your iOS push server needs to know the token before it can push to this device
// here is where you might want to send it the token for later use.
//alert('device token = ' + result);
sDeviceId = result ;
}
Here in sDeviceId you can get your device token.
To work with Ionic push notification you must be having recent Ionic version released i.e. Ionic version 2, if you have older version (lower than Ionic version 1) it will not work.
The CordovaPush,CordovaPush v5 are already deprecated so don't use them.
For detailed understanding of push notification in Ionic 2 please refer this ionic 2 push

Ionic cordova app working on all browsers and IOS 9, but not anymore on IOS 8 [freezes without error]

I have an Ionic application that worked well under iOS 8.
Now I have updated some code and included the network information plugin and updated to cordova-ios-3.9.2.
I have done some debugging for two days, but I get no errors, not in Xcode and not when I inspect the app using safari webinspector.
However, the app does not work anymore under iOS 8.1. It does work under iOS 9 and all Android versions.
I know it is a vague issue, I hope to find someone who can help. Maybe someone who knows the difference between iOS 8 and 9?
we are using the following plugins:
android.support.v4
com.internrocket.plugins.statusbarcolor
com.ionic.keyboard
cordova-plugin-console
cordova-plugin-crosswalk-webview
cordova-plugin-datepicker
cordova-plugin-device
cordova-plugin-network-information (this one is new between te previous and this release, but I think it does not break it)
cordova-plugin-splashscreen
cordova-plugin-statusbar
cordova-plugin-velda-devicefeedback
cordova-plugin-whitelist
cordova-plugin-x-toast
cordova-plugin-inappbrowser
The changes in the code are minor and well tested on all major browser, plus I get no error in the safari web-inspector, plus it works under iOS 9 so I do not suspect them.
Also strange is that the layout looks strange under IOS8. Maybe it is a css error? I have no idea if this is even possible?
Any help is appreciated!
EDIT:
What I have tried: use the previous ionic code with ios-cordova 3.9.2. This works. Also on iOS 8.1
So I had a similar issue, and I use this plugin:
https://github.com/sindresorhus/gulp-autoprefixer
The issue was that this plugin recommends the following implementation:
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
gulp.task('default', () =>
gulp.src('src/app.css')
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('dist'))
);
What happened is that two weeks ago, iOS 9.3 was released, thus removing support for iOS 8 and breaking my app, and having some really irate customers.
The fix was to specify the versions I needed supported.
gulp.task('default', () =>
gulp.src('src/app.css')
.pipe(autoprefixer({
browsers: ['ios_saf >= 7', 'Chrome >= 42'],
cascade: false
}))
.pipe(gulp.dest('dist'))
);
Hope that helps someone out there!
The issues was with the CSS prefixes. Between releases we had accidentially removed some of them. Without the -webkit- css prefix the ios app breaks without warning or error.

Resources