小编dav*_*vid的帖子

无法使用类型为'(String?)'的参数列表调用类型为'Double'的初始值设定项

我有两个问题:

let amount:String? = amountTF.text
Run Code Online (Sandbox Code Playgroud)
  1. amount?.characters.count <= 0

它给出了错误:

Binary operator '<=' cannot be applied to operands of type 'String.CharacterView.IndexDistance?' (aka 'Optional<Int>') and 'In
Run Code Online (Sandbox Code Playgroud)
  1. let am = Double(amount)

它给出了错误:

Cannot invoke initializer for type 'Double' with an argument list of type '(String?)'
Run Code Online (Sandbox Code Playgroud)

我不知道如何解决这个问题.

int xcode ios swift

10
推荐指数
2
解决办法
3万
查看次数

如何更改导航栏高度

我看到了一个改变导航栏高度的解决方案.但没有什么对我有用.现在我的应用程序有一个与导航控制器连接的视图控制器.我还没有在我的项目中实现任何其他代码.在开始我的项目之前,我需要更改导航栏的高度.

编辑:

.H:

- (CGSize)sizeThatFits:(CGSize)size ;
Run Code Online (Sandbox Code Playgroud)

.M:

@implementation UINavigationBar (customNav)
- (CGSize)sizeThatFits:(CGSize)size {
    CGSize newSize = CGSizeMake(370,40);
    return newSize;
}
@end
Run Code Online (Sandbox Code Playgroud)

objective-c ios

5
推荐指数
1
解决办法
4718
查看次数

线程 0 因 ARM 线程状态(64 位)而崩溃

我将我的应用程序提交到应用程序商店,他们说应用程序启动时崩溃。但对于我的设备和模拟器来说,它工作正常。无法找到这里的问题。

我附上了苹果给我的带有崩溃文件的二进制图像。请让我知道任何能够解决该问题的人。

这是崩溃文件

谢谢

在此输入图像描述

崩溃显示在这里:

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   WCi                             0x0000000100df0454 specialized closure #1 in MainScreenViewController.getAdressName(coords:) + 509012 (MainScreenViewController.swift:668)
1   WCi                             0x0000000100e01ed4 partial apply for closure #1 in MainScreenViewController.getAdressName(coords:) + 581332 (MainScreenViewController.swift:0)
2   WCi                             0x0000000100de0288 _T0SaySo11CLPlacemarkCGSgs5Error_pSgIegxx_So7NSArrayCSgSo7NSErrorCSgIeyByy_TR + 443016 (MainScreenViewController.swift:0)
3   libdispatch.dylib               0x00000001d96596c8 0x1d95f9000 + 394952
4   libdispatch.dylib               0x00000001d965a484 0x1d95f9000 + 398468
5   libdispatch.dylib               0x00000001d96069a4 0x1d95f9000 + 55716
6   CoreFoundation                  0x00000001d9bb0df4 0x1d9b05000 + 703988
7   CoreFoundation                  0x00000001d9babcbc 0x1d9b05000 + 683196
8   CoreFoundation                  0x00000001d9bab1f0 0x1d9b05000 + …
Run Code Online (Sandbox Code Playgroud)

location app-store ios

5
推荐指数
1
解决办法
1万
查看次数

如果用户拒绝摄像头访问,则无法显示警报

如果用户拒绝相机访问,我将显示一个带有取消和设置按钮的警报以显示它。但代码不起作用。

@IBAction func ProfileImageButton(_ sender: UIButton) {
        print("profile image Button is pressed")
        let imagePickerController = UIImagePickerController()
        imagePickerController.delegate = self
        profileimgbool = true
        let actionSheet = UIAlertController(title: "Photo Source", message: "choose a Source", preferredStyle: .actionSheet)

        actionSheet.addAction(UIAlertAction(title: "Camera", style: .default, handler: {(action:UIAlertAction) in imagePickerController.sourceType = .camera
            self.present(imagePickerController, animated: true, completion: nil)

        }))

        actionSheet.addAction(UIAlertAction(title: "Photo Library", style: .default, handler: {(action:UIAlertAction) in imagePickerController.sourceType = .photoLibrary
            self.present(imagePickerController, animated: true, completion: nil)}))

        actionSheet.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))



        self.present(actionSheet, animated: true, completion: nil)

    }

 func checkCameraPermission() …
Run Code Online (Sandbox Code Playgroud)

iphone xcode alert objective-c ios

1
推荐指数
1
解决办法
5170
查看次数

标签 统计

ios ×4

objective-c ×2

xcode ×2

alert ×1

app-store ×1

int ×1

iphone ×1

location ×1

swift ×1