我有一个独特的'字符串'不包含定义问题.
请遵循以下VIew代码:
@if (ViewBag.Stories != null)
{
if (ViewBag.Stories.Count > 0)
{
<h2>Stories (@ViewBag.Stories.Count)</h2>
<ul>
@foreach (var item in ViewBag.Stories)
{
<li>
@("test".ToString().ToSeoUrl())
<h2>@(item.Title.ToString().ToSeoUrl())</h2>
</li>
}
</ul>
}
}
Run Code Online (Sandbox Code Playgroud)
如果我从item.Title中删除'.ToString().ToSeoUrl()',我得到:
测试
标题
测试
标题
测试
标题
如果我把它添加回去.我得到了例外
'/'应用程序中的服务器错误.
'string'不包含'ToSeoUrl'的定义
我正在使用Razor并在View中注册了以下帮助器类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web.Mvc;
namespace MyNamespace.Helpers
{
public static class StringExtensions
{
public static string ToSeoUrl(this string url)
{
// make the url lowercase
string encodedUrl = (url ?? "").ToLower();
// replace & with …
Run Code Online (Sandbox Code Playgroud) 我有一个似乎是一个相当普遍的问题,但我的搜索和解决方案的实现还没有解决.
我已经构建了一个仅用于景观的Cocos2d游戏,但需要访问Gamecenter.Gamecenter正在工作,启用了纵向模式,但它也允许游戏翻转到纵向模式.
我尝试了以下修复:
仅横向应用程序中的GameCenter身份验证会引发UIApplicationInvalidInterfaceOrientation
将GameCenter添加到仅横向cocos2d应用程序后,iOS 6出错
我认为问题在于我使用CCLayers而不是UIViewControllers构建了游戏
示例:MenuLayer.h
@interface MenuLayer : CCLayer <GKAchievementViewControllerDelegate, GKLeaderboardViewControllerDelegate, UINavigationControllerDelegate>{
..my header info..
}
Run Code Online (Sandbox Code Playgroud)
MenuLayer.m
...
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
-(BOOL)shouldAutorotate {
return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait;
}
-(void)authenticateLocalPlayer
{
GKLocalPlayer * localPlayer= [GKLocalPlayer localPlayer];
if(localPlayer.authenticated == NO)
{
NSString *reqSysVer = @"6.0";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
{
[[GKLocalPlayer localPlayer] setAuthenticateHandler:(^(UIViewController* viewcontroller, NSError *error) {
if (viewcontroller != nil) …
Run Code Online (Sandbox Code Playgroud)