我想iOS为我的申请制作贴纸包.我一直在环顾四周,我设法通过Xcode做贴纸应用程序.我的问题是我不想要一个独立的贴纸应用程序.用户永远不会去商店单独下载.
我希望贴纸包含在我的经典应用程序中,比如"额外":"你已经下载了应用程序,谢谢你,这里有你可以在消息中使用的贴纸".
我试着像这里解释的那样做"添加目标"
但是当我运行我的应用程序时,我可以在我的消息传递应用程序中看到我的视图控制器但不能看到我
有谁可以帮助我吗 ?
我目前正在我的应用中显示视频,我希望用户能够将其保存到其设备库/专辑照片/相机胶卷.这是我正在做的,但视频没有保存在相册中:/
func downloadVideo(videoImageUrl:String)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), {
//All stuff here
print("downloadVideo");
let url=NSURL(string: videoImageUrl);
let urlData=NSData(contentsOfURL: url!);
if((urlData) != nil)
{
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0];
let fileName = videoImageUrl; //.stringByDeletingPathExtension
let filePath="\(documentsPath)/\(fileName)";
//saving is done on main thread
dispatch_async(dispatch_get_main_queue(), { () -> Void in
urlData?.writeToFile(filePath, atomically: true);
print("videoSaved");
})
}
})
}
Run Code Online (Sandbox Code Playgroud)
我也看看这个:
let url:NSURL = NSURL(string: fileURL)!;
PHPhotoLibrary.sharedPhotoLibrary().performChanges({
let assetChangeRequest = PHAssetChangeRequest.creationRequestForAssetFromVideoAtFileURL(url);
let assetPlaceHolder = assetChangeRequest!.placeholderForCreatedAsset;
let albumChangeRequest = PHAssetCollectionChangeRequest(forAssetCollection: self.assetCollection)
albumChangeRequest!.addAssets([assetPlaceHolder!])
}, completionHandler: saveVideoCallBack)
Run Code Online (Sandbox Code Playgroud)
但我有错误"无法从文件创建数据(null)".我的"assetChangeRequest"是零.我不明白,因为我的网址是有效的,当我使用浏览器访问它时,它会下载一个快速时间文件.
如果有人可以帮助我,我们将不胜感激!我正在使用Swift并定位iOS …
我正在下载一个视频,感谢downloadTaskWithURL,我用这段代码将它保存到我的画廊:
func saveVideoBis(fileStringURL:String){
print("saveVideoBis");
let url = NSURL(string: fileStringURL);
(NSURLSession.sharedSession().downloadTaskWithURL(url!) { (location:NSURL?, r:NSURLResponse?, e:NSError?) -> Void in
let mgr = NSFileManager.defaultManager()
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0];
print(documentsPath);
let destination = NSURL(string: NSString(format: "%@/%@", documentsPath, url!.lastPathComponent!) as String);
print(destination);
try? mgr.moveItemAtPath(location!.path!, toPath: destination!.path!)
PHPhotoLibrary.requestAuthorization({ (a:PHAuthorizationStatus) -> Void in
PHPhotoLibrary.sharedPhotoLibrary().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideoAtFileURL(destination!);
}) { completed, error in
if completed {
print(error);
print("Video is saved!");
self.sendNotification();
}
}
})
}).resume()
}
Run Code Online (Sandbox Code Playgroud)
它在我的模拟器上工作得非常好,但在我的iPad上,即使print("Video is saved!");显示,视频也不会保存.你知道为什么吗?
我的控制台中也出现了该消息
无法从文件创建数据(null)
我的应用程序中有一个扩展程序,允许用户选择其“照片/图片”应用程序中的图片或视频,以发布在我的应用程序中。
通过执行以下操作,我将图片数量限制为20个,将视频数量限制为1个:

但是,我希望我的用户选择多张图片或一个视频,而这种配置是不可能的。
我已经阅读了这篇文章:NSExtension分享扩展限制照片计数
他们解释说我可以执行自定义验证规则,但是我不知道如何编写它。还有其他激活参数吗?有人可以帮助编写规则吗?
提前致谢!
我想在我的应用程序中(通过代码)知道我的用户在哪个应用程序商店(如英国/法国/西班牙等)。
我已经读到我们可以用语言环境做到这一点:https : //developer.apple.com/documentation/foundation/nslocale/1643060-countrycode
但我想用 Apple Store 来做。出于法律目的,我不想为欧洲人显示与美国人相同的内容。
有人已经做到了吗?谢谢 !
我正在Web视图中加载一个html页面,我想应用一个本地css文件.我从服务器接收字符串中的html,css将在我的应用程序中.例如,我想显示"你好!" 红色的.
self.articleView = UIWebView(frame : CGRect(x : self.articleButton.frame.minX, y : self.articleButton.frame.maxY + 1, width : self.frame.width - 20, height: self.frame.height - self.articleButton.frame.maxY - 10));
self.articleView.backgroundColor = UIColor.clearColor();
self.addSubview(self.articleView);
self.articleView.loadHTMLString("<html><body><h1>Hello!</h1></body></html>", baseURL: nil)
Run Code Online (Sandbox Code Playgroud)
你知道怎么申请css吗?我应该尝试使用WKWebView吗?
提前致谢.
我有一个带有搜索栏作为标题的 UITableView。当用户在搜索栏中进行搜索时,我使用此函数来更新我的数据。
func updateSearchResults(for searchController: UISearchController) {
if let searchText = searchController.searchBar.text {
if (searchText.characters.count > 0) {
self.filteredResults = [];
self.locationManager?.geocodeAddressString(addressString: searchText, completionHandler: { (results, error) in
if error == nil && results != nil {
self.filteredResults = results!;
self.tableView.reloadData();
}
});
}
else {
self.filteredResults = [];
self.tableView.reloadData();
}
}
}
Run Code Online (Sandbox Code Playgroud)
以及当我在 UITableView 中选择一个单元格时的这个功能。
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.delegate?.setCity(city: str);
self.dismiss(animated: true, completion: nil);
}
Run Code Online (Sandbox Code Playgroud)
这是我的问题:在第一次点击单元格时,视图控制器不会关闭。我点击一次,搜索栏辞职响应者。我需要点击两次才能执行解雇。
这是我如何在 viewDidLoad 中链接我的 tableview 和搜索栏:
// Search Bar …Run Code Online (Sandbox Code Playgroud) 我目前正在为我发布的Android应用程序测试Android O.
我的Gradle每次都失败,因为它正在寻找文件:"C:\ Users\M?lanie.gradle\caches".你可以看到我的名字包含一个有问题的角色,我已经因为它而移动了我的Android sdk.
如何移动.gradle文件夹?
我试图将"GRADLE_USER_HOME"设置为"C:\ Android\gradle"(该文件夹存在),但Android Studio的行为方式仍然相同.
android gradle android-studio android-gradle-plugin android-8.0-oreo
我有一个使用 socket.io 的 Node.js 服务器和一个 android 应用程序。我希望我的应用程序连接到服务器。(我在当地工作)
所以首先我启动服务器: 命令提示符
这是它的代码:
var express = require('express'); // call express
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = process.env.PORT || 1234;
app.get('/',function(req,res){
res.send("Welcome to my socket");
});
io.on('connection', function (socket) {
console.log('one user connected : '+socket.id);
// when the client emits 'new message', this listens and executes
socket.on('new message', function (data) {
// we tell the client to execute 'new message'
console.log('this is message :',data);
}); …Run Code Online (Sandbox Code Playgroud) 我有一个用Swift制作的iOS应用程序,这是一个小社交网络.用户可以使用登录/密码连接,我将其保存在私人服务器上的数据库中.我想实现TouchID以帮助他们更快地登录.但是,我的用户帐户未与其Apple ID相关联.
// Touch ID button has been clicked
func touchIDButtonClicked() {
print("touchIDButtonClicked");
//Is Touch ID hardware available & configured?
if(authContext.canEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, error:&error))
{
//Perform Touch ID auth
authContext.evaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason: "Connect to the network with your fingertips", reply: {(wasSuccessful:Bool, error:NSError?) in
if(wasSuccessful)
{
//User authenticated
print("OK");
// Log the user
}
else
{
//There are a few reasons why it can fail, we'll write them out to the user in the label
print("NO");
// Tell the user to use his password …Run Code Online (Sandbox Code Playgroud) ios ×8
swift ×8
android ×2
ipad ×2
iphone ×2
app-store ×1
connection ×1
css ×1
gradle ×1
imessage ×1
info.plist ×1
ios10 ×1
node.js ×1
search ×1
socket.io ×1
sockets ×1
touch-id ×1
uisearchbar ×1
uitableview ×1