我想禁用我的应用程序的iTunes文件共享.我去了info.plist并添加了一个UIFileSharingEnabled等于的条目NO.
当我运行应用程序并转到iExplorer时,我的应用程序仍然具有可见的Documnets文件夹库等等.我还需要执行哪些其他步骤?
Apple如何计算iAd横幅的展示次数. 我意识到这不是一个特别的编程问题,但它会严重影响iAd的实现.我正在使用共享横幅实例 - 所有视图控制器上的相同横幅.
当viewController模态呈现另一个视图控制器时,我有一个隐藏横幅的应用程序.如果横幅是可见的,但在转换到第二个视图控制器期间变得不可见(仅在很短的时间内),那是一种印象吗?是否需要通过时间段才能将横幅视为展示?该时间段必须具有传染性,或者我是否允许显示添加例如.5秒,3秒的添加是不可见的,相同的添加是否可见另外25秒?那仍然是一种印象吗?如何使用共享横幅实例?如果我从一个VC转换到另一个VC,则该共享横幅实例在0.5秒内不可见.这种中断会导致不会产生展示次数吗?展示次数是按广告加载bannerViewDidLoadAd方式的次数计算的吗?
Swift提供编写扩展的功能.我做了很多,以使我的代码更容易阅读.不确定它们是否无害.我想知道,由于性能原因,省略扩展会更好吗?
我正在使用重要的位置变更监控.当我在模拟器中运行代码并检查高速公路选项时,我会定期更新位置.我抓住这些更新并将它们保存在NSUserDefaults中,然后每10秒更新一次tableview,这样我就可以看到我是否有任何更新.如果我在真实设备上运行应用程序,我会得到零更新.我把手机放在口袋里,走了80多公里,去过两个城市.零更新.不确定我是否搞砸了什么.我附上了代码.代码是复制粘贴,随意测试.只需确保在storyboard中使用TableViewController并将cell id设置为ID.我错过了什么?我在iphone 5上测试.
info.plist中:
编辑:在Apple docs中找到它.我的locationManager创作应该不同吗?
当应用程序因位置更新而重新启动时,传递给应用程序的启动选项字典:willFinishLaunchingWithOptions:或application:didFinishLaunchingWithOptions:方法包含UIApplicationLaunchOptionsLocationKey键.该键的存在表示新位置数据正在等待传递到您的应用程序.要获取该数据,您必须创建一个新的CLLocationManager对象,并在应用程序终止之前重新启动您运行的位置服务.重新启动这些服务时,位置管理器会将所有挂起的位置更新传递给其委托.
EDIT2:
基于此,位置应至少每15分钟更新一次.我的代码中的错误已确认.
如果GPS级精度对您的应用并不重要,并且您不需要持续跟踪,则可以使用重要更改位置服务.正确使用重要更改位置服务至关重要,因为它至少每15分钟唤醒系统和您的应用程序,即使没有发生位置更改,也会持续运行直到您停止它.
edit3:将此代码添加到AppDelegate didFinishLaunchingWithOptions:以查看应用程序是否被唤醒.它没有被唤醒 - 我在表格视图中看不到200 200条目.可疑的东西正在发生.
if let options = launchOptions {
print("options")
if (launchOptions![UIApplicationLaunchOptionsLocationKey] != nil){
locationManager.startUpdatingLocation()
self.lat.append(Double(200))
self.lon.append(Double(200))
self.times.append(NSDateFormatter.localizedStringFromDate(NSDate(), dateStyle: .NoStyle, timeStyle: .ShortStyle))
NSUserDefaults.standardUserDefaults().setObject(lat, forKey: "lat")
NSUserDefaults.standardUserDefaults().setObject(lon, forKey: "lon")
NSUserDefaults.standardUserDefaults().setObject(times, forKey: "time")
}
Run Code Online (Sandbox Code Playgroud)
代码:// AppDelegate:
import UIKit
import CoreLocation
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
var lat:[CLLocationDegrees]!
var lon:[CLLocationDegrees]!
var times:[String]!
var distances: [String]!
var window: UIWindow?
var locationManager: CLLocationManager!
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: …Run Code Online (Sandbox Code Playgroud) 我已将 redis-server 配置为使用带requirepass选项的密码。
运行时,redis-cli我有两个选项来访问数据库。
redis-cli -a mypassword命令。这将密码存储在 bash 历史记录中。每次运行它时,我都需要删除历史记录条目。AUTH mypassword在 redis-cli 内部使用。遗憾的是,此选项会将您的密码保存在 redis-cli 中,即使您在没有任何身份验证的情况下登录 redis-cli,也可以通过按向上箭头查看它。它确实可以在没有任何保护的情况下访问。验证 redis-cli 的正确方法是什么?
我的后端检查用户是否有权使用以下代码上传资源:
<?php
if(!isset($_SESSION["id"])){
http_response_code(401);
die("Error. Unauthorized user.");
}
Run Code Online (Sandbox Code Playgroud)
为此,开发角度app运行angular.example.com:4200需要将会话cookie跨域发送到example.com.我通常{withCredentials:true}在发送请求时启用它.出于某种原因,使用以下代码上传文件时,这不起作用:
//no cookies sent in this example
import { HttpClient, HttpEventType } from '@angular/common/http';
//function
const fd = new FormData();
for (let i = 0; i < files.length; i++) {
let file = files[i] as File;
fd.append("myfile[]", files[i], files[i].name);
}
this.httpClient.post("https://example.com/upload.php", fd, { reportProgress: true, observe: "events", withCredentials: true }).subscribe((event) => {
console.log(event);
// show upload progress code here
});
Run Code Online (Sandbox Code Playgroud)
服务器响应:
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://angular.example.com:4200
Cache-Control: …Run Code Online (Sandbox Code Playgroud) 我试图在场景出现之前指定屏幕的背景颜色(当前为黑色)。我搜索了文档,这是我发现的:
\n\n\n\n\n\n\n
var background: SCNMaterialProperty { get }在场景的其余部分之前渲染的背景。(只读)\n 如果材质属性\xe2\x80\x99s 内容对象为 nil,则 SceneKit 在绘制场景的其余部分之前\n 不会绘制任何背景。(如果场景在 SCNView 实例中呈现,则视图\xe2\x80\x99s 背景色\n 在场景内容后面可见。)
\n
所以我去把内容发送到某种颜色。
\n\nscene.background.contents = UIColor.redColor()\nRun Code Online (Sandbox Code Playgroud)\n\n然而,在场景渲染之前,屏幕(其中的 SCNView 部分)仍然是黑色的。我究竟做错了什么?也许背景属性不是我需要的?另外,我不太确定是否可以进一步深入某些仅 get(bacground 是 getter)的属性,而不是像我在代码示例中那样设置一些内容。谢谢回答
\n我正在重写 UIImage 类方法init(named:)。我的目标是能够检索图像的文件名。
代码如下所示:
class UIImageWithFileName: UIImage {
let fileName: String
override init(named:String){
super.init(named)
fileName = named
}
}
Run Code Online (Sandbox Code Playgroud)
由于以下原因,此代码似乎是不可能的。
我创建了一个 UIImage 的子类,开始输入 init... 令我惊讶的是没有 init(named:) 方法可以覆盖。这是 init 方法的完整列表:
如何覆盖UIImage init(named:)
当我使用触控板滚动时,工具栏和主窗口之间有一个白色间隙(在“这是顶部”标题之上)。您可以在我所附的图片中看到它。仅当我使用触控板(而不是鼠标)滚动超出窗口底部的顶部或底部时,才会出现此间隙。如何设置该背景的颜色超出“正常”窗口?
// 当我不滚动时:
@import url("960_12_col.css");
#header{
background-color: blue;
height: 400px;
margin-top: 80px;
margin-bottom: 30px;
color: white;
padding-left: 50px;
padding-top: 40px;
box-sizing: border-box;
}
.grid_4{
/*
text-align: center;
background-color: red;
margin-top: 30px;
height: 250px;
border: 20px solid black;
box-sizing: border-box;
*/
}
.grid_3{
padding:10px;
border: 5px solid black;
margin: 10px;
height: 140px;
box-sizing: border-box;
}
#comment1{
text-align: left;
}
#comment2{
text-align: center;
}
#comment3{
text-align: center;
}
#comment4{
text-align: right;
}
#leftImage{
}
#centerImage{
}
#rightImage{
}
.image{
text-align: center;
background-color: …Run Code Online (Sandbox Code Playgroud)ios ×7
adbannerview ×1
angular ×1
colors ×1
css ×1
file-sharing ×1
html ×1
iad ×1
impressions ×1
itunes ×1
overriding ×1
redis ×1
scene ×1
scenekit ×1
storyboard ×1
subclassing ×1
swift ×1
swift2 ×1
uiimage ×1
uistoryboard ×1