我是Xcodeprojects中使用pod的初学者.我被pod file.lock弄糊涂了.我想将框架"OBJECTMAPPER"更新为2.0以使其与swift 3兼容.但它不会.
为什么不更新到最新版本(2.0).它与pod file.lock有什么关系吗?如下 - >
为什么用它?
我刚刚想出了如何在我的应用中正确发送推送通知.但是当它开始正常工作时,就会出现一种新的错误.收到推送通知后,我的应用程序在启动时崩溃.我在5台设备上进行了测试,其中2台由于问题而崩溃(两台都在iOS_10.3.1上运行).奇怪的部分是在iOS 10.2和9.3.1上运行的其他3个设备.我真的不认为这是与操作系统有关的东西.
Apple发送了这样的崩溃日志,但当我点击项目中的open时,它只会打开我的启动屏幕xib

我的appDelegate类APNS服务调用part->
func registerForPushNotifications(application: UIApplication)
{
if #available(iOS 10.0, *){
UNUserNotificationCenter.currentNotificationCenter().delegate = self
UNUserNotificationCenter.currentNotificationCenter().requestAuthorizationWithOptions([.Badge, .Sound, .Alert], completionHandler: {(granted, error) in
if (granted)
{
UIApplication.sharedApplication().registerForRemoteNotifications()
}
else{
CommonViewController.alertViewUI("Alert", message: "Push notification is enabled")
}
})
}
else{ //If user is not on iOS 10 use the old methods we've been using
let notificationSettings = UIUserNotificationSettings(
forTypes: [.Badge, .Sound, .Alert], categories: nil)
application.registerUserNotificationSettings(notificationSettings)
}
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序功能 - >启动时-----------------------
用于了解用户版本的版本检查类.从那里将其重定向到主(主页).
在主页 - > 1.加载视图.2.异步调用链接,并在警报符号附近显示可用通知的计数.(我很确定在调用此链接或获取通知时没有错误)------------ -------------
注意:**当双击iPhone主页按钮菜单时,应用程序在后台显示为打开的主屏幕打开的屏幕(崩溃后).
**一个10.3.1设备正常工作
**如果重新安装该应用程序,一切正常.
我用键盘出现在textfield下面
在View上加载添加观察者()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(Gold_Loan_First_ViewController.keyboardDidShow(_:)), name: UIKeyboardDidShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(Gold_Loan_First_ViewController.keyboardWillBeHidden(_:)), name: UIKeyboardWillHideNotification, object: nil)
Run Code Online (Sandbox Code Playgroud)
然后更新框架
weak var activeField: UITextField?
func textFieldDidEndEditing(textField: UITextField) {
self.activeField = nil
}
func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
if textField==txtOTP {
txtOTP.errorMessage=""
}
return true
}
func textFieldDidBeginEditing(textField: UITextField) {
self.activeField = textField
}
func keyboardDidShow(notification: NSNotification)
{
if let activeField = self.activeField,
let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.CGRectValue() {
let contentInsets = UIEdgeInsets(top: 0.0, left: 0.0, …Run Code Online (Sandbox Code Playgroud) 这个问题之前有人问过。但我的要求不一样。我有一个这样的工作流程
任何帮助将不胜感激
我的代码库到现在
import UIKit
import WebKit
class WebKitViewController: UIViewController {
@IBOutlet weak var webView: WKWebView!
var pdfUrl:URL!
override func viewDidLoad() {
super.viewDidLoad()
self.setViewContext()
}
func setViewContext() {
let url = URL(string: "https://www.example.com")!
webView.navigationDelegate = self
webView.load(URLRequest(url: url))
}
func downloadPDF(fromUrl url:String) {
guard let url = URL(string: url) else …Run Code Online (Sandbox Code Playgroud) 我有一个安全的 webView,它显示客户加载他的钱包。我传递安全信息 MPIN(如一次性密码)。有问题的是
@IBOutlet weak var loading: UIActivityIndicatorView!
@IBOutlet var lblLoading: UILabel!
@IBOutlet weak var mob_webview: UIWebView!
override func viewDidLoad()
{
super.viewDidLoad()
mob_webview.hidden = true
mob_webview.delegate=self
cmmn.createDatabase()
linkgot = cmmn.geturl()
link="http://*****************************************.jsp?"
let request = NSMutableURLRequest(URL: NSURL(string: link)!)
request.HTTPMethod = "POST"
let postString = "recharge_type=\(_catcode)&amount=\(_amountfiled_got)&mobileNo=\(cmmn.getPhoneNumber())&prePostLan=\(prePostLan)&stdCode=\(_stdCode)&accNo=\(accNo)&deduct_frm=B&rcMobileNum=\(_numberfiled_got)&mobOperator=\(_merch_code)&operator=\(_operatr)&rcType=\(_rec_type)&mpin=\(_mpin)"
request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding)
let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
data, response, error in
if error != nil {
print("error=\(error)")
return
}
print("response = \(response)")
let responseString = NSString(data: data!, encoding: NSUTF8StringEncoding)
print("responseString = \(responseString)")
}
task.resume()
mob_webview.loadRequest(request) …Run Code Online (Sandbox Code Playgroud) 我真的很沮丧,因为我将我的项目从Xcode 7.3迁移到Xcode 8.2.我在我的项目中使用了storyboard和Xib文件.在运行我的项目时,我遇到了这个奇怪的错误.我的一些xib文件被调整大小或重新整形(缩小以适合/扩展以适合).所有这些Xib文件在Xcode 7.3中都完美地运行.
如上所示,上面的视图控制器xib与Iphone5相同.但是在运行时它会扩展到蓝线.我完全相信自动布局是正确的.我已经通过将xib文档的开放类型从Xcode8更改为Xcode7来解决了这个问题,但效果不佳.它似乎一次又一次地重复着.在上面的布局中,我的观点是这样排列的.为什么会这样呢?这是一个错误
已经尝试过: 链接
我遇到了raywenderlich的一个教程,作者为处理单例中的线程问题提供了一些很好的技巧。但是,当使用单例类中的闭包时,他使用的是“弱”引用循环。确实需要这样做吗,因为类是单例的,所以应该总是有一个实例?
final class PhotoManager {
private init() {}
static let shared = PhotoManager()
private var unsafePhotos: [Photo] = []
let concurrentPhotoQueue = DispatchQueue(label: "com.jeesson.googlypuff.photoQueue", attributes: .concurrent)
var photos: [Photo] {
var photoCopy:[Photo]!
concurrentPhotoQueue.sync {
photoCopy = self.unsafePhotos
}
return photoCopy
}
func addPhoto(_ photo: Photo) {
// Do we need 'weak self here.. and why?
concurrentPhotoQueue.async(flags: .barrier) {[weak self] in
// 1
guard let self = self else {
return
}
self.unsafePhotos.append(photo)
DispatchQueue.main.async { [weak self] in
//self?.postContentAddedNotification()
}
} …Run Code Online (Sandbox Code Playgroud) singleton memory-management weak-references grand-central-dispatch swift
我在我的应用程序中使用 Uber Api。尝试预订行程时出现问题。我收到 httpStatus 400 错误。根据他们的文档,这可能是由于多种因素造成的。

我怎么能通过状态代码(总是“400”)知道给定类型的哪个描述导致它?
我现在的代码:
if let httpstatuscode = response as? NSHTTPURLResponse
{
if (error != nil)
{
print("Error : \(error?.localizedDescription)")
}
else if httpstatuscode.statusCode != 202 && httpstatuscode.statusCode != 409
{
print("Status Code\(httpstatuscode.statusCode)")
dispatch_async(dispatch_get_main_queue(), { () -> Void in
CommonViewController.alertViewUI("Alert", message: "Internal Server Error!")
})
}
else if httpstatuscode.statusCode == 409
{
// self.getUberRideLive()
print("Status Code\(httpstatuscode.statusCode)")
CommonViewController.alertViewUI("Alert", message: "You are already on a ride!")
}
Run Code Online (Sandbox Code Playgroud)