小编sma*_*nja的帖子

didReceiveRemoteNotification未调用,iOS 10

在iOS 9.3中,该didReceiveRemoteNotification方法在以下两种情况下都会被调用.

1)当收到推送通知时2)当用户通过点击通知启动应用程序时.

但在iOS上10,我注意到,该didReceiveRemoteNotification方法不,当用户通过点击通知启动应用程序触发.只有在收到通知时才会调用它.因此,在通知启动应用程序后,我无法执行任何进一步操作.

应该解决这个问题?任何的想法?

objective-c apple-push-notifications ios swift3

67
推荐指数
7
解决办法
6万
查看次数

比较两个数组并获得常用项

我有两个数组,但它们有不同的长度.我想比较这两个数组并将常用项放入一个新数组.同时不应该有重复的项目是第三个数组.我真的搞砸了,请给我一个帮助.非常感谢...

iphone objective-c iphone-sdk-3.0 ios

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

将BOOL值设置为NSMutableDictionary

我想将一个BOOL值设置为NSFutableDictionary的真假格式(它将用作API请求的JSON字典).我尝试了以下两种方法.但这些不是API请求的正确格式(API需要BOOL值为true/false类型而不是1/0).

BOOL isDefault = YES;
[dicTemp setValue:[NSString stringWithFormat:@"%c", isDefault] forKey:@"is_default"];

//[dicTemp setValue:[NSNumber numberWithBool:isDefault] forKey:@"is_default"];
Run Code Online (Sandbox Code Playgroud)

任何人都可以有一个想法

iphone objective-c ios ios5

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

AWS推送通知服务集成错误

我正在尝试将Amazon Push Notifications集成到我的iPhone应用程序中.我确实按照这里提供的教程.

创建Platform EndPoint时出现此错误.(似乎身份池的权限问题???)

CognitoIdentityCredentials is not authorized to perform: SNS:CreatePlatformEndpoint
Run Code Online (Sandbox Code Playgroud)

完整信息:

Error: Error Domain=com.amazonaws.AWSSNSErrorDomain Code=4 "The operation couldn’t be completed. (com.amazonaws.AWSSNSErrorDomain error 4.)" UserInfo=0x165dcef0 {Type=Sender, Message=User: arn:aws:sts::290442422498:assumed-role/Cognito_Laugh_DevUnauth_Role/CognitoIdentityCredentials is not authorized to perform: SNS:CreatePlatformEndpoint on resource: arn:aws:sns:us-east-1:290442422498:app/APNS_SANDBOX/Laugh, __text=(
"\n    ",
"\n    ",
"\n    ",
"\n  "
), Code=AuthorizationError}
Run Code Online (Sandbox Code Playgroud)

AWSRegionType const CognitoRegionType = AWSRegionUSEast1;
AWSRegionType const DefaultServiceRegionType = AWSRegionUSEast1;
NSString *const CognitoIdentityPoolId = @"us-east-1:0..................";
NSString *const SNSPlatformApplicationArn = @"arn:aws:sns:us-east-1:................";
NSString *const MobileAnalyticsAppId = @"YourMobileAnalyticsAppId";


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions …
Run Code Online (Sandbox Code Playgroud)

objective-c amazon-web-services amazon-sns ios aws-sdk

17
推荐指数
2
解决办法
4715
查看次数

UIPickerView选择指示器在iOS10中不可见

我在Xcode 8中构建我的项目.UIPickerView分隔线在iOS 10模拟器和设备中不可见,但在iOS 9.3设备和模拟器上工作正常.我尝试在XIB中调整UIPickerView背景颜色,自动布局和一切可能,但没有任何作用.有人对此有所了解吗?

这是一个包含UIPickerView的自定义视图

在此输入图像描述

-(void)layoutSubviews{
isShown = NO;
[super layoutSubviews];

//self.selectedDic = nil;

self.doneBtn.tintColor = COLOR_DB3535;
self.pickerView.backgroundColor = COLOR_DEDEDE;
self.pickerView.showsSelectionIndicator = YES;

[self.doneBtn setTitle:NSLocalizedString(@"App_Generic_Button_Text_Done", @"")];
}


-(UIView*)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
label.tintColor = [UIColor clearColor];
label.backgroundColor = [UIColor yellowColor];
label.textColor = COLOR_666;
label.font = [FontsManager getFONT_ROBOTO_LIGHT_16];
label.textAlignment = NSTextAlignmentCenter;
NSDictionary *dict = [dataArray objectAtIndex:row];
label.text = @"Test";
return label;
}
Run Code Online (Sandbox Code Playgroud)

objective-c uipickerview ios ios10 xcode8

15
推荐指数
4
解决办法
8322
查看次数

在录制时实时上传音频片段?

如何在录制时将音频片段实时上传到服务器?基本上我的要求是在录制时将音频剪辑上传为chucks/packets.我已经使用IQAudioRecorderController https://github.com/hackiftekhar/IQAudioRecorderController完成了录制部分.它记录音频并保存到TemporaryDirectory.

我想知道如何在不保存音频片段的情况下实时上传.

这是录音部分

//Unique recording URL


NSString *fileName = [[NSProcessInfo processInfo] globallyUniqueString];
_recordingFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.m4a",fileName]];


// Initiate and prepare the recorder

_audioRecorder = [[AVAudioRecorder alloc] initWithURL:[NSURL fileURLWithPath:_recordingFilePath] settings:recordSetting error:nil];
_audioRecorder.delegate = self;
_audioRecorder.meteringEnabled = YES;


// Recording start
- (void)recordingButtonAction:(UIBarButtonItem *)item
{
 if (_isRecording == NO)
  {
    _isRecording = YES;

    //UI Update
    {
        [self showNavigationButton:NO];
        _recordButton.tintColor = _recordingTintColor;
        _playButton.enabled = NO;
        _trashButton.enabled = NO;
    }

    /*
     Create the recorder
     */
    if ([[NSFileManager defaultManager] fileExistsAtPath:_recordingFilePath])
    {
        [[NSFileManager …
Run Code Online (Sandbox Code Playgroud)

objective-c avaudiorecorder ios avaudiosession

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

将UIProgressBar添加到UITableViewCell

我需要UIProgressBarUITableviewCell播放音频剪辑时显示输入.

我尝试运行a NSTimer然后尝试更新进度视图,但它不起作用.这是我的代码.请让我知道这种方法有什么问题.

运行计时器

self.timer = [NSTimer scheduledTimerWithTimeInterval:0.25
                                          target:self
                                        selector:@selector(updatePlayProgress)
                                        userInfo:nil
                                         repeats:YES];
Run Code Online (Sandbox Code Playgroud)

更新TableviewCell中的UIProgressView

- (void)updatePlayProgress {
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

    NSLog(@"Duration %f", appDelegate.moviePlayer.duration);
    NSLog(@"Current time %f", appDelegate.moviePlayer.currentPlaybackTime);

    float timeLeft = appDelegate.moviePlayer.currentPlaybackTime/appDelegate.moviePlayer.duration;

    // upate the UIProgress
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:playingIndex inSection:0];
    FeedCell *cell = (FeedCell*)[self tableView:self.tblView cellForRowAtIndexPath:indexPath];

    NSLog(@"Time left %f", timeLeft);

    cell.progressPlay.progress = 0.5;

    [cell.progressPlay setNeedsDisplay];
}
Run Code Online (Sandbox Code Playgroud)

的cellForRowAtIndexPath

fCell.progressPlay.alpha = 0.5;
fCell.progressPlay.tintColor = navigationBarColor;
[fCell.progressPlay setTransform:CGAffineTransformMakeScale(fCell.frame.size.width, fCell.frame.size.height)];

[fCell.progressPlay setHidden:NO];

return fCell;
Run Code Online (Sandbox Code Playgroud)

输出应该与此类似

在此输入图像描述

objective-c uitableview uiprogressview uiprogressbar ios

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

UIImagePickerController相机视图大小问题

我正在使用UIImagePickerController和自定义叠加来构建应用程序.什么是比较两个图像(图像之前和图像之后).拍摄后照片时,我正在使用与之前图像的自定义叠加(请参阅附图).

iPhone 5 - ios7 在此输入图像描述

iPhone 4 - iOS7(拍摄图像时) 在此输入图像描述

iPhone 4 - iOS 7(拍照后) 在此输入图像描述

查看iPhone 4和iPhone 5相机视图之间的大小差异.

应用程序适用于iPhone 5屏幕尺寸(ios 6和ios7).但iPhone 4/4s的屏幕尺寸,只适用于iOS6.问题是iphone 4/4s(仅适用于ios7),摄像头视图全屏显示.这意味着,你可以注意到iPhone 5的摄像头视图大小~320*427(iOS 6和iOS 7)iPhone 4摄像头视图大小~320*427(iOS 6)但是iPhone 4摄像头视图大小~320*480(iOS 7).

拍摄完图像后,它的实际尺寸为320*427.由于这个问题,我无法在iPhone 4 iOS7上使用相机视图在图像前对齐(因为它的尖叫到320*480).

有没有人面对这个奇怪的问题.我几乎尝试了一切,但没有运气.有什么想法吗???

这是我在照片叠加前用自定义加载相机视图的片段代码.

- (void)loadCameraWithImage
{
    if (!isLoadedOnce)
    {
    isLoadedOnce = YES;
            UIImagePickerController *cameraView = [[UIImagePickerController alloc] init];
           cameraView.sourceType = UIImagePickerControllerSourceTypeCamera;
           cameraView.wantsFullScreenLayout = NO;

        if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
         [self setEdgesForExtendedLayout:UIRectEdgeNone];
        }


    // crop before image

    UIImage *imgTmpCropped = [self imageByCropping:imgBefore toRect:CGRectMake(0, 0, imgBefore.size.width/2, imgBefore.size.height)];
    UIImage *overleyImage = [[UIImage alloc] …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uiimagepickercontroller ios ios7

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

如何从方法返回多个值

我有 - (CLLocationCoordinate2D)方法,我想从该方法返回多个位置(这些位置在另一个方法中使用)我的方法看起来像这样,

-(CLLocationCoordinate2D) addressLocation{
 - --------
 ----------
 return location;
 }
Run Code Online (Sandbox Code Playgroud)

是否有可能返回多个位置(我的意思是返回 location1,返回 location2 ......)?? 请帮我谢谢

iphone objective-c return-value cllocationmanager ios

7
推荐指数
2
解决办法
3862
查看次数

iTunes备份和还原是否适用于通过OTA部署的iOS应用程序?

我正在通过OTA(Testflight)向客户部署应用程序.我听说如果我们使用相同的配置文件用于Appstore分发来部署OTA应用程序,那么正常的iTunes备份和恢复过程应该可行.这是对的吗?

但目前我正在这样做.我也使用相同的App Store分发配置文件通过OTA进行部署.但OTA应用程序不通过iTunes显示/同步?

任何的想法??

iphone itunes objective-c ios testflight

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