小编Moh*_*der的帖子

Google+ api中的错误代码403

我收到"错误":{ "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } 当我尝试通过https://www.googleapis.com/plus/v1/people/me URL字符串获取Google+ api中的用户个人资料时.如果有人有任何建议,请尽快告诉我.在此先感谢您的时间.

google-plus google-api-objc-client

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

是否可以在iOS中使用KVC将值设置为只读属性?

我试图在这里描述我的困惑.如果这个问题需要任何修改,请告诉我.

Accordind to Apple documentaition: readonly属性的参考 -

Apple文档链接

所以我们不能将值设置为readonly属性,因为它的setter不会被创建.但是我已经创建了一个用于测试它的演示项目.我正在和你分享我的代码示例.

这是"ModelTest1.h"类.它有一个只读属性.

#import <Foundation/Foundation.h>

@interface ModelTest1 : NSObject

@property (readonly) NSMutableArray  *arrTest;

@end
Run Code Online (Sandbox Code Playgroud)

现在我正在使用KVC设置它的价值.因为这个属性是readonly,所以在运行时它应该给我一个错误,但它没有发生.

- (void)readonlyTest
{
    ModelTest1  *obj1 = [ModelTest1 new];

    NSLog(@"obj1.arrTest before = %@",obj1.arrTest);

    [obj1 setValue:[NSMutableArray new] forKey:@"arrTest"];

    NSLog(@"obj1.arrTest after = %@",obj1.arrTest);

    [obj1.arrTest addObject:@"Str 1"];

    NSLog(@"obj1.arrTest after 2 = %@",obj1.arrTest);

    [obj1 release];
}
Run Code Online (Sandbox Code Playgroud)

输出是:

控制台输出

我不知道为什么内存在NSMutableArray中被分配,即使它只是readonly.为什么字符串会添加到此只读数组中.

我还使用KVC对NSString进行了内存分配测试并得到了相同的结果.使用KVC将值设置为只读字符串.

这是我对readonly属性的setValue的困惑.

所以我误解了一些关于readonly财产的事情?或者还有其他事情发生?

objective-c readonly-attribute ios

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

如何使用iOS中的SLRequest使用私人推文发布图像?

我有一个问题,我有一些粉丝,我想发送一个带有图像的直接消息给所有粉丝,但我没有办法做到这一点.

我研究整个文档但无法找到方法.

我的代码在这里:

NSString   *strUrl = @"https://api.twitter.com/1.1/direct_messages/new.json";
NSURL      *url    = [NSURL URLWithString:strUrl];
strUrl = nil;

NSMutableDictionary    *parameters = [NSMutableDictionary new];
[parameters setValue:@"name" forKey:@"screen_name"];
[parameters setValue:@"123456" forKey:@"user_id"];
[parameters setValue:@"sending text" forKey:@"text"];

// Creating a request.
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter
                                                 requestMethod:SLRequestMethodPOST
                                                           URL:url
                                                    parameters:parameters];

NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.greenuplawnandsprinklers.com/uploads/design_sample_landscape.jpg"]];
[request addMultipartData:imageData
                 withName:@"media[]"
                     type:@"image/jpeg"
                 filename:@"image.jpg"];
imageData = nil;

[request setAccount:twitAccount];
url        = nil;
parameters = nil;

// Perform the request.
[request performRequestWithHandler:^(NSData *responseData,NSHTTPURLResponse *urlResponse,NSError *error)
{
dispatch_async(dispatch_get_main_queue(), ^{
      // Check if we …
Run Code Online (Sandbox Code Playgroud)

twitter post ios slrequest

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

AVAssetExportSessionStatusFailed:视频导出失败,错误 -16364

我正在研究视频的慢动作效果,在 iOS 11 下一切正常,但在 iOS 11 上出现以下错误:

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-16364), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x608000456620 {Error Domain=NSOSStatusErrorDomain Code=-16364 "(null)"}}
Run Code Online (Sandbox Code Playgroud)

我试图找出有关此问题的信息,但没有找到任何确切的解决方案。

下面是我的代码供参考:

    - (void)applySlowMoOnAsset:(NSURL *)assetURL {
    AVAsset *videoAsset = [[AVURLAsset alloc] initWithURL:assetURL options:nil];

    AVMutableComposition *mixComposition = [AVMutableComposition composition];
    AVMutableCompositionTrack *compositionVideoTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo
                                                                                   preferredTrackID:kCMPersistentTrackID_Invalid];

    AVMutableCompositionTrack *compositionAudioTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];

    AVAssetTrack *videoAssetTrack = [[videoAsset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0];

    NSError *videoInsertError = nil;

    BOOL videoInsertResult = [compositionVideoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, videoAsset.duration)
                                                            ofTrack: videoAssetTrack …
Run Code Online (Sandbox Code Playgroud)

objective-c avfoundation ios avassetexportsession avasset

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

如何使用NSThread获取UIView的屏幕截图?

我正在开发一个应用程序,我需要从一个线程中截取屏幕截图.我无法使用以下代码执行此操作:

UIGraphicsBeginImageContextWithOptions(self.view.frame.size, YES, [[UIScreen mainScreen] scale]);

[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *resultingImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)

如果有人要将此问题标记为重复,那么请提供一个正确的链接来回答并请关注此问题我也在询问有关在线程中创建图像的问题.

谢谢你的时间.

uiview nsthread ios

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