我刚刚升级到xcode 4.0,我无法再部署到iPhone,我得到Apple Mach-O链接器错误,但它仍适用于模拟器.
Ld /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Intermediates/iParcel.build/Debug-iphoneos/iParcel.build/Objects-normal/armv7/iParcel normal armv7
cd /Users/yveswheeler/iParcel
setenv IPHONEOS_DEPLOYMENT_TARGET 3.2
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk -L/Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos -F/Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos -filelist /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Intermediates/iParcel.build/Debug-iphoneos/iParcel.build/Objects-normal/armv7/iParcel.LinkFileList -dead_strip -all_load -ObjC -lxml2 -miphoneos-version-min=3.2 -framework UIKit -framework CoreGraphics -framework QuartzCore /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20.a /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20Core.a /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20Network.a /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20Style.a /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20UI.a /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20UICommon.a /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20UINavigator.a -framework AddressBook -lz.1.2.3 -framework Foundation -framework CFNetwork -framework MobileCoreServices -framework SystemConfiguration -framework MessageUI -framework AudioToolbox -o /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Intermediates/iParcel.build/Debug-iphoneos/iParcel.build/Objects-normal/armv7/iParcel
arm-apple-darwin10-g++-4.2.1: /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20.a: No such file or directory
arm-apple-darwin10-g++-4.2.1: /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20Core.a: No such file or directory
arm-apple-darwin10-g++-4.2.1: /Users/yveswheeler/Library/Developer/Xcode/DerivedData/iParcel-fkeqjcjcbbhjwhdssjptkdxzzzxh/Build/Products/Debug-iphoneos/libThree20Network.a: No such file or directory …Run Code Online (Sandbox Code Playgroud) 我希望我的函数计算我的Double类型数组的平均值.该数组称为"投票".现在,我有10个号码.
当我调用average function以获得阵列投票的平均值时,它不起作用.
这是我的代码:
var votes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
func average(nums: Double...) -> Double {
var total = 0.0
for vote in votes {
total += vote
}
let votesTotal = Double(votes.count)
var average = total/votesTotal
return average
}
average[votes]
Run Code Online (Sandbox Code Playgroud)
我如何在此处调用平均值来获得平均值?
[Xcode 7.1,iOS 9.1]
我有一个数组: var array: [String] = ["11", "43", "26", "11", "45", "40"]
我想将它(每个索引)转换为一个Int,所以我可以使用它从一个定时器倒计时,相应的索引.
如何在Swift 2中将String数组转换为数组Int?
我已经尝试了几个链接,没有一个工作,所有这些都给了我一个错误.链接中的大多数代码都已折旧或尚未更新为swift 2,例如toInt()方法.
我正在使用a UITableviewcontroller,我希望页脚视图始终位于屏幕的底部.然而,y所述的位置页脚视图正在改变,因为每height的tableviewcell.我怎么能一直坚持到屏幕的底部?
我有一个UITextField特定于处理Date文本的子类.我有一个tableviewcell使用此文本字段:
let dateInput: DateTextField
Run Code Online (Sandbox Code Playgroud)
现在控制器需要初始化dateInput显示之前的文本,如下所示:
cell.dateInput.text = "01/29/2016"
Run Code Online (Sandbox Code Playgroud)
现在,我希望能够检测到从子类更改的文本,以便我可以更新内部日期变量,以便它与文本同步.
我实现了textfield委托方法,但只捕获用户所做的更改,而不是以编程方式.
我想在UIAlertController或UIPopoverController中显示UIPickerView,我是iOS新手,请在这里给我一些示例代码.
我搜索了他们但找不到任何满意的答案.我不想在UIActionSheet上这样做,因为它在iOS 9中已被弃用.我也希望它在Swift中而不是在Obj-C中.我尝试了下面的例子,但它不适合我.
http://makeapppie.com/2014/08/30/the-swift-swift-tutorials-adding-modal-views-and-popovers/
uipickerview uipopovercontroller ios swift uialertcontroller
在XCode 6.3和XCode 7中使用swift代码运行我的项目时,我收到此错误:
无法打开文件"***.app",因为您无权查看该文件
我的应用程序不再启动了.我检查了编译器设置是否正确.可执行文件名和包名称也是正确的.
多次清理项目,也删除了XCtest目标.
我正在构建动态框架,在其中导入 GoogleMobileAds 框架(我没有将其链接为二进制)
我只是将其导入到类代码中,同时将框架保留在项目路径上,而不在构建阶段的“链接二进制文件”中链接它
import GoogleMobileAds
Run Code Online (Sandbox Code Playgroud)
我在尝试构建项目时收到此错误:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GADInterstitial", referenced from:
static VeediSDK_admob.VeediUtils.loadNewAdd (VeediSDK_admob.VeediUtils.Type)() -> __ObjC.GADInterstitial in
VeediUtils.o
"_OBJC_CLASS_$_GADRequest", referenced from:
static VeediSDK_admob.VeediUtils.loadNewAdd (VeediSDK_admob.VeediUtils.Type)() -> __ObjC.GADInterstitial in VeediUtils.o
ld: symbol(s) not found for architecture arm64
Run Code Online (Sandbox Code Playgroud)
由于我正在构建框架,因此我不想将 GoogleMobileAds 直接链接到框架。
我确保链接了 GoogleMobileAds 所需的所有系统框架,并确信这不是问题
有什么想法如何解决这个问题吗?
我有一系列图像,我希望能够向前(向左)滑动到下一个图像,或向后(向右)滑动到上一个图像.当imageList达到-1 /超出范围时,应用程序崩溃.我无法弄清楚如何将其保持在范围内的逻辑.
这是我的代码:
var imageList:[String] = ["image1.jpg", "image2.jpg", "image3.jpg"]
let maxImages = 2
var imageIndex: NSInteger = 1
Run Code Online (Sandbox Code Playgroud)
滑动手势在我的viewDidLoad()方法中,不确定这是否是正确的位置......:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var swipeRight = UISwipeGestureRecognizer(target: self, action: "swiped:") // put : at the end of method name
swipeRight.direction = UISwipeGestureRecognizerDirection.Right
self.view.addGestureRecognizer(swipeRight)
var swipeLeft = UISwipeGestureRecognizer(target: self, action: "swiped:") // put : at the end of method name
swipeLeft.direction = UISwipeGestureRecognizerDirection.Left
self.view.addGestureRecognizer(swipeLeft)
image.image = UIImage(named:"image1.jpg") …Run Code Online (Sandbox Code Playgroud) Xcode 不允许我对BarButtonItemMainStoryBoard 中的 ViewController施加约束。如图所示,它出现在左边太远的地方,无法读取。
下图显示了它的BarButtonItem位置。它应该说“项目”。我还查看了 Xcode 上的预览分屏,它对于 iPhone6 来说看起来不错,但对于 iPhone 4 来说却不是(它在 iPhone 4 上被剪了一半,但在这里是 3/4 秒)。在这里,我正在运行 iPhone 6,我明白了。
如何在 Xcode 中添加约束或如何以编程方式将约束添加到此 BarButtonItem?
任何帮助深表感谢。
我创建了一个名为MyUILabel的UILabel子类.唯一改变的是字体和字体大小.当我运行应用程序时,它看起来像预期的那样 但是,在故事板中,显示了默认的UILabel.有没有办法让Storyboard显示我的子类的字体和字体大小?
MyUILabel:
public class MyUILabel : UILabel {
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.font = UIFont(name: Constants.DefaultFont, size: 30)
}
}
Run Code Online (Sandbox Code Playgroud) 我可以下载iOS9 + Xcode 7并仍然将测试应用程序部署到使用当前版本iOS的设备吗?
抱歉相对愚蠢的问题,我是一个新的开发人员,不知道它过去是如何工作的,我在开发者网站上找不到任何东西....
非常感谢.
swift ×10
ios ×6
arrays ×3
xcode ×3
xcode7 ×2
admob ×1
arm64 ×1
autolayout ×1
function ×1
int ×1
ios9 ×1
iphone ×1
nsdate ×1
objective-c ×1
string ×1
swift2 ×1
uikit ×1
uipickerview ×1
uitableview ×1
xcode4 ×1