我尝试按照Google OAuth2ForDevices实施Google oauth .
我的应用程序已在Google Cloud Console上注册为本机应用程序.当我尝试使用Google Chromes - Advanced Rest Client Application关注OAuth2ForDevices时,我会收到带有user_code和verfication_url的json响应.打开verfication_url并输入user_code会导致以下错误:
invalid_client:没有支持电子邮件错误400
我在Google云端控制台上使用了两个注册的应用尝试了此操作.两者都导致同样的错误.
Anys提示,如何解决这个问题?我是否必须support email在谷歌云服务中注册?
我收到以下错误:
Class 'App\Http\Controllers\File' not found
Run Code Online (Sandbox Code Playgroud)
当在laravel 5控制器中使用时:
$files = File::files( $this->csvDir );
Run Code Online (Sandbox Code Playgroud)
我必须将文件系统添加到composer.json和config/app.php.不知怎的,我使用了错误的配置.
这就是我改变的:
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "5.*",
"illuminate/filesystem": "5.*" /* my try to repo */
},
Run Code Online (Sandbox Code Playgroud)
'providers' => [
// [...]
// jerik 2015-04-17: get html Forms
// http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider', // try to add file
Run Code Online (Sandbox Code Playgroud)
当我运行时composer update,它运行良好,但没有输出文件系统的输出.所以我的配置错了,但我不知道正确的方法.
有什么建议或提示吗?
在相机工作流程中,照片被捕获,在下一个屏幕上,我们称之为选择屏幕,您可以选择是否要使用此照片或重新拍摄.
当相机进入预览视图时,我怎么知道?
我的问题是我添加了一个按钮来访问相机胶卷,效果很好.拍摄照片并进入预览视图(2.相机视图)时,按钮隐藏了"使用照片"选项.所以我不能选择它.我想在进入预览视图时隐藏按钮,或者只是避开预览视图.

在我的代码下面
#import <UIKit/UIKit.h>
#import "CameraViewController.h"
#import <AssetsLibrary/AssetsLibrary.h>
@interface CamViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) UIImage *lastTakenImage;
- (IBAction)takePhoto:(id)sender;
- (IBAction)selectPhoto:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
#import "CamViewController.h"
@interface CamViewController ()
@end
@implementation CamViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
int isAction = 0; // Photo, 1: CameraRoll, …Run Code Online (Sandbox Code Playgroud) 您想通过使用AFNetworking 2.0将一些数据(字符串和文件)发送到服务器.不知何故,POST请求(对于forumlar)的数据不正确,看起来缺少请求的编码/序列化.由于服务器无法使用我上传的数据.
如何为请求设置编码/序列化?
我假设必须设置URL表单参数编码.文档说明
[[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters];
Run Code Online (Sandbox Code Playgroud)
我试图这样做,但我无法弄清楚如何正确地做到这一点.通过以下Xcode通过警告:
manager.requestSerializer = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters];
Run Code Online (Sandbox Code Playgroud)
/.../CameraViewController.m:105:31:从'NSMutableURLRequest*'分配给'AFHTTPRequestSerializer*'的指针类型不兼容
在我的源代码下面:
#import <UIKit/UIKit.h>
@interface CameraViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
Run Code Online (Sandbox Code Playgroud)
#import "CameraViewController.h"
#import "AFHTTPRequestOperationManager.h"
@interface CameraViewController ()
@property (nonatomic) int photoIsTaken;
@end
@implementation CameraViewController
// removed unecessary code for this question
- (void)upload {
NSLog(@"%s: uploader ", __FUNCTION__);
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *parameters = @{@"latitude": @"8.444444",
@"longitude": @"50.44444",
@"location": @"New York",
@"type": …Run Code Online (Sandbox Code Playgroud) 我想测试我的基本身份验证页面.未授权测试工作正常.但我在授权登录方面很费劲,因为我不知道如何在测试中设置标头.
我找不到提示,如何设置标题$this->call().我能找到的唯一信息是:
$this->call($method, $uri, $parameters, $cookies, $files, $server, $content);
Run Code Online (Sandbox Code Playgroud)
并且缺少标题.
如何在laravel上轻松测试基本身份验证.具体:如何为测试请求设置基本auth标头?
我目前拥有的:
class ExampleTest extends TestCase {
public function test401UnauthorizedOnMe() {
$response = $this->call('GET', '/api/me');
$this->assertResponseStatus( 401);
}
public function testCorrectLoginOnMe() {
// http://shortrecipes.blogspot.de/2009/12/testing-basic-http-authentication-using.html
//send header with correct user and password i.e.
////YWRtaW46YWRtaW4xMg== is equal to base64_encode( "admin:admin12")
$this->request->setHeader( 'Authorization','Basic YWRtaW46YWRtaW4xMg==');
$response = $this->call('GET', '/api/me');
$this->assertResponseStatus(200);
}
}
Run Code Online (Sandbox Code Playgroud)
我试过$this->$request->setHeader();但是这个我只得到一个错误:
1) ExampleTest::testCorrectLoginOnMe
ErrorException: Undefined property: ExampleTest::$request
Run Code Online (Sandbox Code Playgroud) 在一些iPhone应用程序我看到了一个按钮,这是漂浮在内容视图,例如.在应用程序EyeEm.当用户滚动内容时,按钮保持原样并且仍然是交互元素.
我可以实现这个吗?
我的方法是:
编辑:
浮动似乎是默认行为.有趣的是addSubview,insertSubview当放置按钮时具有相同的行为......两者都漂浮在内容上.
- (void)addOverlayButton {
UIButton *oButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[oButton addTarget:self
action:@selector(aMethod:)
forControlEvents:UIControlEventTouchDown];
[oButton setTitle:@"Show View" forState:UIControlStateNormal];
oButton.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[self.view addSubview:oButton];
//[self.view insertSubview:oButton aboveSubview:_scrollView]; // same result as addSubview.
// Both solutions let the button float over the content.
}
Run Code Online (Sandbox Code Playgroud) 我想更改身份验证过程以使用另一个视图模板.例如,resources/views/auth/register.blade.php不应使用它resources/views/register.blade.php.
但我很难找到调用此视图的代码.
我发现的唯一的地方是,app/Services/Register但只有验证器失败.默认情况下调用视图时我需要这个位置.
在UICollectionView上我想用图像填充CollectionViewCell.但是我得到以下错误:
我的错误在哪里,我该如何解决?
2013-01-29 22:25:38.606 foobar[1277:c07] CollectionViewController loaded with searches: 22
2013-01-29 22:25:38.609 foobar[1277:c07] id: 0 -> content: <UIImage: 0xaa618e0>
2013-01-29 22:25:38.610 foobar[1277:c07] -[UICollectionViewCell cellImageView]: unrecognized selector sent to instance 0x939a7b0
2013-01-29 22:25:38.610 foobar[1277:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICollectionViewCell cellImageView]: unrecognized selector sent to instance 0x939a7b0'
*** First throw call stack:
(0x1d9f012 0x139fe7e 0x1e2a4bd 0x1d8ebbc 0x1d8e94e 0x478a 0x7e9a1a 0x7eb034 0x7ed2d1 0x33792d 0x13b36b0 0x2afffc0 0x2af433c 0x2af4150 0x2a720bc 0x2a73227 0x2a738e2 0x1d67afe 0x1d67a3d 0x1d457c2 0x1d44f44 0x1d44e1b 0x1cf97e3 0x1cf9668 0x2e765c …Run Code Online (Sandbox Code Playgroud) 在我的mongodb集合中,我想将一些元素推到现有数组中。我使用jenssegers / Laravel-MongoDB-雄辩的模型和查询生成器与lavavel和mongodb一起使用。
如何在jenssegers / Laravel-MongoDB中使用$ push运算符?
{
"_id": ObjectId("5328bc2627784fdb1a6cd398"),
"comments": {
"0": {
"id": 3,
"score": 8
}
},
"created_at": ISODate("2014-03-18T21:35:34.0Z"),
"file": {
"file_id": NumberLong(1175),
"timestamp": NumberLong(1395178534)
}
}
Run Code Online (Sandbox Code Playgroud)
RockMongo和mongo shell数组的文档表示形式有些不同。看一下comments-array。上面的RockMongo表示形式在mongo shell中显示为:
{
"_id" : ObjectId("5328c33a27784f3b096cd39b"),
"comments" : [
{
"id" : 3,
"score" : 8
}
],
"created_at" : ISODate("2014-03-18T22:05:46Z"),
"file" : {
"file_id" : NumberLong(1176),
"timestamp" : NumberLong(1395180346)
}
}
Run Code Online (Sandbox Code Playgroud)
如文档所述,$push操作员将元素推入数组。这在mongo-shell中可以正常工作:
db.Images.update({'file.file_id': 1175},
{ …Run Code Online (Sandbox Code Playgroud) 我正在我的laravel 5应用程序中实现twilio.要在框架中使用它,我使用aloha/laravel-twilio集成.
使用测试凭证发送有效请求可以正常工作.当我想实现错误处理时,我遇到了问题.
由于某种原因,catch没有得到错误,导致应用程序崩溃.twilio-sdk如果我正确读取错误消息,似乎错误.
这是我到目前为止所做的:
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
use Aloha\Twilio\TwilioInterface;
class Activation extends Model {
protected $fillable = array( 'a', 'b', 'c');
public static function send() {
// Testaccount
// $toNumber = '+15005550006'; // valid number; works fine
$toNumber = '+15005550001'; // @todo will throw an exeption, and breaks the app
try {
\Twilio::message( $toNumber, 'Pink Elephants and Happy Rainbows');
} catch ( Services_Twilio_RestException $e ) {
elog( 'EACT', $e->getMessage( …Run Code Online (Sandbox Code Playgroud) php ×5
laravel-5 ×4
ios ×3
objective-c ×3
laravel ×2
arrays ×1
button ×1
camera ×1
device ×1
floating ×1
google-oauth ×1
iphone ×1
mongodb ×1
namespaces ×1
oauth-2.0 ×1
overlay ×1
phpunit ×1
post ×1
push ×1
registration ×1
request ×1
selector ×1
try-catch ×1
twilio ×1
twilio-php ×1
uiimage ×1
uiimageview ×1
unit-testing ×1
view ×1
xcode ×1