小编Alo*_*lok的帖子

位置服务在iOS 8中不起作用

我在iOS 7上运行良好的应用程序无法与iOS 8 SDK一起使用.

CLLocationManager没有返回位置,我也没有在设置 - > 位置服务下看到我的应用程序.我在这个问题上进行了谷歌搜索,但没有出现任何问题.可能有什么不对?

location objective-c cllocationmanager ios8

606
推荐指数
15
解决办法
27万
查看次数

Xcode 10错误:产生多个命令

error: Multiple commands produce '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist':
1) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
2) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Server/Masonry/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
3) Target 'OptimalLive' has process command with input '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist'
Run Code Online (Sandbox Code Playgroud)

在Xcode9中运行代码有效,但在Xcode10中导致错误.

info.plist xcode10

552
推荐指数
50
解决办法
27万
查看次数

如何将UITextView的大小调整为其内容?

有没有一种很好的方法来调整a的大小UITextView以符合其内容?比方说我有一个UITextView包含一行文字:

"Hello world"
Run Code Online (Sandbox Code Playgroud)

然后我添加另一行文字:

"Goodbye world"
Run Code Online (Sandbox Code Playgroud)

在Cocoa Touch中是否有一个好方法rect可以保存文本视图中的所有行,以便我可以相应地调整父视图?

再举一个例子,查看日历应用程序中事件的注释字段 - 注意单元格(及其UITextView包含)如何扩展以包含注释字符串中的所有文本行.

cocoa-touch uitextview uikit ios autolayout

512
推荐指数
20
解决办法
37万
查看次数

iOS UIImagePickerController上传后的结果图像方向

我在iOS 3.1.3 iPhone上测试我的iPhone应用程序.我使用以下方法选择/捕获图像UIImagePickerController:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setDelegate:self];
[self.navigationController presentModalViewController:imagePicker animated:YES];
[imagePicker release];



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    self.image = [info objectForKey:UIImagePickerControllerOriginalImage];
    imageView.image = self.image;
    [self.navigationController dismissModalViewControllerAnimated:YES];
    submitButton.enabled = YES;
}
Run Code Online (Sandbox Code Playgroud)

然后我在某个时候使用ASI类将它发送到我的Web服务器:

ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://example.com/myscript.php"]];
[request setDelegate:self];
[request setStringEncoding:NSUTF8StringEncoding];
[request setShouldContinueWhenAppEntersBackground:YES];
//other post keys/values
[request setFile:UIImageJPEGRepresentation(self.image, 100.0f) withFileName:[NSString stringWithFormat:@"%d.jpg", [[NSDate date] timeIntervalSinceNow]] andContentType:@"image/jpg" forKey:@"imageFile"];
[request startAsynchronous];
Run Code Online (Sandbox Code Playgroud)

问题:当我用iphone拍照同时保持它的风景时,图像会上传到服务器并按照你的预期进行查看.当拍摄手机拍照时,图像会被上传并在旋转90度时被观看.

我的应用程序设置为仅在纵向模式下工作(颠倒和常规).

如何在上传后使图像始终显示正确的方向?

UIImageView中显示的图像看起来是正确的(在拍照后直接显示),但在服务器上查看则另有说明.

iphone cocoa-touch uiimagepickercontroller uiimage ios

327
推荐指数
11
解决办法
13万
查看次数

从另一个(iPhone)启动应用程序

是否可以从另一个应用程序中启动任意iPhone应用程序?例如, 在我的应用程序中,如果我希望用户按下按钮并启动到手机应用程序(关闭当前应用程序,打开手机应用程序).

这有可能吗?我知道可以使用tel URL链接拨打电话,但我想改为启动Phone应用而不拨打任何特定号码.

iphone deep-linking openurl ios

165
推荐指数
11
解决办法
19万
查看次数

iOS:应用程序在安装应用程序时不会询问用户的权限.每次都得到kCLAuthorizationStatusNotDetermined - Objective-c&Swift

我正在尝试在我的iOS应用中获取用户位置.我首先在我的项目中包含了重置框架.然后在按钮上单击我调用核心位置api,如下所示.当我尝试在设备中安装它时,核心位置永远不会询问用户权限.当我尝试在按钮单击时获取位置时,我将获得kCLAuthorizationStatusNotDetermined作为authorisationStatus.请帮帮我.我不知道发生了什么.

- (IBAction)fetchLessAccurateLocation:(id)sender {
    [self.txtLocation setText:@""];

    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
    locationManager.distanceFilter = 1000;

    if ([self shouldFetchUserLocation]) {
        [locationManager startUpdatingLocation];
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的shouldFetchUserLocation方法:

-(BOOL)shouldFetchUserLocation{

    BOOL shouldFetchLocation= NO;

    if ([CLLocationManager locationServicesEnabled]) {
        switch ([CLLocationManager authorizationStatus]) {
            case kCLAuthorizationStatusAuthorized:
                shouldFetchLocation= YES;
                break;
            case kCLAuthorizationStatusDenied:
            {
                UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Error" message:@"App level settings has been denied" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil];
                [alert show];
                alert= nil;
            }
                break;
            case kCLAuthorizationStatusNotDetermined:
            {
                UIAlertView *alert= [[UIAlertView alloc]initWithTitle:@"Error" message:@"The user is yet …
Run Code Online (Sandbox Code Playgroud)

gps core-location cllocationmanager ios

70
推荐指数
6
解决办法
9万
查看次数

在cocos2d游戏中集成Gamecenter

有谁知道如何在Cocos2d中集成游戏中心.请告诉我步骤,以便我可以将其整合到我的游戏中.

cocos2d-iphone game-center

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

React native-创建单例模式的最佳方式

我是反应原生编码的新手,但在Objective-c和swift编码方面经验丰富,并希望在反应原生中使用单例模式.我试图找出其他StackOverflow答案的解决方案,但大多数都只创建单例函数,如下面的代码:

var Singleton = (function () {
    var instance;

    function createInstance() {
        var object = new Object("I am the instance");
        return object;
    }

    return {
        getInstance: function () {
            if (!instance) {
                instance = createInstance();
            }
            return instance;
        }
    };
})();

function run() {

    var instance1 = Singleton.getInstance();
    var instance2 = Singleton.getInstance();

    alert("Same instance? " + (instance1 === instance2));  
}
Run Code Online (Sandbox Code Playgroud)

正如我们在上面的代码中看到的,我们创建的是单例函数而不是类.如果有任何方法可以创建单例类并将该类中的多个变量作为objective-c或swift传递,请告诉我.注意:如果我的方向错误,也请通知我.

singleton reactjs react-native

9
推荐指数
2
解决办法
8724
查看次数

使用大型UIImage数组时的内存问题导致崩溃(swift)

在我的应用程序中,我有一个图像阵列,可以保存在我的相机上拍摄的所有图像.我正在使用collectionView来显示这些图像.但是,当此图像阵列达到大约20张图像时,它会崩溃.我相信这是由于内存问题..如何以一种内存效率的方式将图像存储在图像阵列中?

Michael Dauterman使用缩略图提供了答案.我希望除此之外还有一个解决方案.也许将图片存储到NSData或CoreData中?

Camera.swift:

//What happens after the picture is chosen
func imagePickerController(picker:UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject:AnyObject]){
    //cast image as a string
    let mediaType = info[UIImagePickerControllerMediaType] as! NSString
    self.dismissViewControllerAnimated(true, completion: nil)
    //if the mediaType it actually is an image (jpeg)
    if mediaType.isEqualToString(kUTTypeImage as NSString as String){
        let image = info[UIImagePickerControllerOriginalImage] as! UIImage

        //Our outlet for imageview
        appraisalPic.image = image

        //Picture taken, to be added to imageArray
        globalPic = image

        //image:didFinish.. if we arent able to save, pass to contextInfo in Error …
Run Code Online (Sandbox Code Playgroud)

camera uiimage ios swift

8
推荐指数
3
解决办法
9297
查看次数

没有使用iTunes Connect Access的帐户

我正在尝试向应用商店提交应用,该应用是根据我的个人Apple ID开发的,并且是代表第三方提交的(我的Apple ID是管理员).我收到一条错误消息,指出即使我拥有管理员/法律权利,也无法找到iTunes Connect帐户.

我究竟做错了什么?该应用程序正在使用其配置文件等进行签名

iphone itunes app-store ios application-loader

8
推荐指数
2
解决办法
9175
查看次数