我正在开发一个离子聊天应用程序,用户可以在其中上传照片作为其消息的一部分.我正在寻找一种方法将图像上传到我的webhost服务器,以便稍后通过URL检索它.
问题是我无法将其上传到我的网络服务器.
我正在使用这两个插件:
当我在xcode模拟器中运行应用程序并从设备photolibrary中选择一张图片时,控制台会给我以下消息:
File Transfer Finished with response code 200void SendDelegateMessage(NSInvocation *): delegate (webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode>SUCCESS: ""这是我目前使用的代码:
app.controller('HomeController', function($rootScope, $scope, $cordovaCamera, $ionicActionSheet, $cordovaFileTransfer){ ...
// open PhotoLibrary
$scope.openPhotoLibrary = function() {
var options = {
quality: 100,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageData) {
//console.log(imageData);
//console.log(options);
var url = "http://mydomein.com/upload.php";
//target path may be …Run Code Online (Sandbox Code Playgroud) 我正在研究chatapp,就像大多数chatapps一样,我的应用程序显示了一个消息列表.
ng-repeat.目前,当我的应用加载时,列表向下滚动
$ ionicScrollDelegate
我不喜欢这样做.这不是正确的方法,有时这会在打开我的应用程序时给我一些性能和加载问题.
我想知道是否有另一种强制方式,从底部到顶部开始/渲染列表,而不需要像现在一样将其滚动到底部.
这是我目前使用的代码:
在我的HTML中:
<script type="text/ng-template" id="home.html">
<ion-view ng-controller="HomeController" title="Home">
<ion-content>
<ion-list>
<ion-item ng-repeat="message in messages track by $index">
{{message}}
</ion-item>
</ion-list>
</ion-content>
</ion-view>
</script>
Run Code Online (Sandbox Code Playgroud)
在我的app.js:
app.run(function($ionicPlatform, $state, $timeout, $localStorage, $location, $rootScope, $ionicScrollDelegate) {
document.addEventListener('deviceReady', function() {
setTimeout(function() {
$ionicScrollDelegate.scrollBottom(true);
}, 500);
});
})
Run Code Online (Sandbox Code Playgroud) 我有一个视图,显示团队中使用@Fetchrequest和固定谓词“开发人员”过滤的消息。
struct ChatView: View {
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \Message.createdAt, ascending: true)],
predicate: NSPredicate(format: "team.name == %@", "Developers"),
animation: .default) var messages: FetchedResults<Message>
@Environment(\.managedObjectContext)
var viewContext
var body: some View {
VStack {
List {
ForEach(messages, id: \.self) { message in
VStack(alignment: .leading, spacing: 0) {
Text(message.text ?? "Message text Error")
Text("Team \(message.team?.name ?? "Team Name Error")").font(.footnote)
}
}...
Run Code Online (Sandbox Code Playgroud)
我想使该谓词动态化,以便在用户切换团队时显示该团队的消息。下面的代码给我以下错误
无法在属性初始化程序中使用实例成员'teamName';属性初始化程序在“自我”可用之前运行
struct ChatView: View {
@Binding var teamName: String
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \Message.createdAt, ascending: true)],
predicate: NSPredicate(format: "team.name == %@", teamName), …Run Code Online (Sandbox Code Playgroud) 我希望我的应用程序在它处于活动状态的背景状态时执行某些操作.我理解根据cordova文档,我可以使用下面的代码执行此操作,这是有效的.
// device APIs are available
//
function onDeviceReady() {
document.addEventListener("resume", onResume, false);
}
// Handle the resume event
//
function onResume() {
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序是使用Ionic构建的,使用上面代码的缺点是它只能在我的app模块之外工作,所以我无法在我的app模块中触发函数.我找到了一些关于它应该如何在我的app模块中工作的代码示例,但是没有它们正在工作.看下面的一些例子.
$ionicPlatform.on('resume', function(){
// rock on
});
Run Code Online (Sandbox Code Playgroud)
/
ionic.Platform.ready(function() {
ionic.on('resume', function(){
//rock on
}, element);
});
Run Code Online (Sandbox Code Playgroud)
/
$ionicPlatform.ready(function () {
document.addEventListener("deviceReady", function () {
document.addEventListener("resume", function () {
$timeout(function () {
//rock on
}, 0);
}, false);
});
});
Run Code Online (Sandbox Code Playgroud)
我忘记了什么,我做错了什么,我希望有人可以帮助我.
谢谢!!
我希望人们使用 Strava 帐户登录(strava 是一个骑行/跑步平台)
Firebase 有一些默认的身份验证登录提供程序,如 Google、twitter 等,但没有 Strava。有没有其他方法可以通过 Firebase 中的 Strava 帐户对用户进行身份验证?
我的项目是在 AngularJS 中