小编Jul*_*anB的帖子

捆绑标识符和推送证书... aps-environment权利错误

我已经阅读了xcode从哪里获取应用程序的标识符?,来自{PRODUCT_NAME}的XCode包标识符格式,并加载更多但......

我正在尝试推送推送通知并让人感到害怕

"Error Domain = NSCocoaErrorDomain Code = 3000"找不到有效的'aps-environment'权利字符串,用于应用程序"UserInfo = 0x15b200 {NSLocalizedDescription = no valid'atps-environment'权利字符串找到应用程序}"错误.

我很确定我已经正确地遵循了所有步骤,包括:

  • 在提供证书之前完成推送证书
  • 制作了'Entitlements.plist'
  • 添加了一个get-task-allow布尔值并将其设置为true(ad-hoc release)

唯一认为我无法理解的是Bundle Identifier

推送证书适用于

XXXXXXXXXX.com.julianbaker.pwcnewsuk
Run Code Online (Sandbox Code Playgroud)

PwCNewUK-Info.plist中的Bundle Indentifier用于

com.julianbaker.${PRODUCT_NAME:rfc1034identifier}
Run Code Online (Sandbox Code Playgroud)

如果我手动将其更改为

com.julianbaker.pwcnewsuk
Run Code Online (Sandbox Code Playgroud)

我得到一个UDID不匹配错误,因为该应用程序被视为PwCNewsUK

当我用谷歌搜索这个问题似乎有些混乱,但它似乎必须匹配?

题:

Bundle Indentifer应该与
XXXXXXXXXX.com.julianbaker.pwcnewsuk 的推送证书相匹配?

题:

我是否需要为配置文件添加"aps-environment"权利,如果是,在何处以及如何添加?(参见http://www.airplaysdk.com/node/3174等)

喜欢iPhone开发,但有时它可能是一个headbanger!

xcode push settings.bundle ios-provisioning

68
推荐指数
5
解决办法
8万
查看次数

从sqlite数据库中删除除最新500行之外的所有行

我的SQL也不错,但iOS上的SQLite不断让我感到困惑.

我有一个表格,我想将行数限制在500左右,所以当它达到550的触发点时,它将删除最早的50行.

随着时间的流逝,id不会始终从1开始,用户可以删除行,因此id是非顺序的.

我有一个juliandate字段(double)但我不确定是否有用

DELETE FROM contents WHERE id > '0' ORDER BY id DESC LIMIT 0, 50
DELETE FROM contents ORDER BY id DESC LIMIT 0, 50
Run Code Online (Sandbox Code Playgroud)

文档说没关系,但它失败了.有任何想法吗?

sqlite iphone delete-row ios

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

当单元格滚动回视图时,表崩溃

iPad:我的桌子表现得很好,直到细胞延伸到可见区域(屏幕高度)之外.部分屏幕外的最后一个单元格向下滚动,使其不再可见,然后向上滚动应用程序崩溃?为什么?

代码重新用于iPhone屏幕,工作正常(这是一个通用的应用程序).被这一个难倒

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"JobCell";

    UITableViewCell *cell;
    NSArray *versionCompatibility = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];

    if ( 6 <= [[versionCompatibility objectAtIndex:0] intValue] )
    {
        // iOS6 is installed
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    }
    else
    {
        // iOS5 is installed
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier ];
    }


    // Configure the cell...
    Job *job = [self.jobs objectAtIndex:indexPath.row];

    NSLog(@"Dealing with cell %d",indexPath.row);

    UIColor *redcol = [UIColor colorWithRed:0.62745098039216 green:0.15294117647059 blue:0.15686274509804 alpha:1.0];

    NSString *jobString = job.jobAddress;
    jobString = …
Run Code Online (Sandbox Code Playgroud)

uitableview ipad ios

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

正确的方法来解决showFromTabBar的顶级UITabBarController视图

主应用程序委托有一个名为tabBarController的UITabBarController(NewsUKDelegate.m)

第一个选项卡加载一个UIViewController,它会添加一个UITableView(FirstViewController.m)

选择单元格时,UITableView加载子类UIViewController(StoryController.m)

然后我从Sharekit加载共享操作表

NSURL *url = [NSURL URLWithString:link];
SHKItem *item = [SHKItem URL:url title:storyTitle];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[actionSheet showFromTabBar:rootView];
[actionSheet showFromTabBar:[self view]];
Run Code Online (Sandbox Code Playgroud)

它起作用(ish)但是动作表从顶部加载似乎是错误的,但重要的是它抱怨了

incompatible Objective-C types 'struct UIView *', expected 'struct UITabBar *' 
when passing argument 1 of 'showFromTabBar:' from distinct Objective-C type
Run Code Online (Sandbox Code Playgroud)

我试过去玩弄

UIWindow *topWindow = [[UIApplication sharedApplication] keyWindow];

if (topWindow.windowLevel != UIWindowLevelNormal)
{
    NSArray *windows = [[UIApplication sharedApplication] windows];
    for(topWindow in windows)
    {
        if (topWindow.windowLevel == UIWindowLevelNormal)
            break;
    }
}

UIView *rootView = [[topWindow subviews] …
Run Code Online (Sandbox Code Playgroud)

iphone uitabbarcontroller uiactionsheet

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

jquery - 测试是否在字段集中检查范围中的特定复选框

我需要查看是否检查了字段集中某个范围内的任何复选框

<fieldset id="issues">
    <input name="A" id="issue_0" type="checkbox" value="A" /> <--- this one
    <input name="B" id="issue_1" type="checkbox" value="B" />
    <input name="C" id="issue_2" type="checkbox" value="C" />
    <input name="D" id="issue_3" type="checkbox" value="D" />
    <input name="E" id="issue_4" type="checkbox" value="E" />
</fieldset>
Run Code Online (Sandbox Code Playgroud)

字段集是#issues,这可以很好地查看是否有任何一个被检查

if( $('#issues input[type="checkbox"]').is(':checked') ){
  console.log("One of them is checked");
}
Run Code Online (Sandbox Code Playgroud)

但我想看看是否检查了索引的特定复选框,即是否检查了第一个复选框.我试过这个......

if( $('#issues input[type="checkbox"][0]').is(':checked') ){
  console.log("Item one is checked");
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用

如何通过字段集中的索引来定位特定复选框?

jquery

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

indexOfObject第一次返回0而不是NSNotFound

我在a中有一个表UIPopoverController,viewDidAppear我检查了存储在standardUserDefaults中的单元格标签的值.(所以我可以使用最后选择的选项).

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *lastMenu = [prefs objectForKey:@"location"];

NSUInteger index = [__menuTitles indexOfObject:lastMenu];

NSLog(@"lastMenu is %@",lastMenu);
NSLog(@"lastMenu index is %i",index);
Run Code Online (Sandbox Code Playgroud)

在第一次激活菜单时生成此选项

lastMenu is 
lastMenu index is 0
Run Code Online (Sandbox Code Playgroud)

后续点击正确报告2147483647的含义 NSNotFound

lastMenu is 
lastMenu index is 2147483647
Run Code Online (Sandbox Code Playgroud)

为什么0第一次返回?

这是阵列

__menuTitles = [[NSArray alloc] initWithObjects:
                @"North America", 
                @"Western Europe", 
                @"Asia Pacific", 
                @"Latin America", 
                @"Central & Eastern Europe", 
                @"Middle East", 
                @"Africa", 
                nil];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c nsarray ios

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

在屏幕外动画UInavigationBar会留下黑色矩形

当模态UIView出现时,我想将UINavigationBar放到屏幕上,就像在Reeder中一样.

我正在使用优秀的SVWebViewController(https://github.com/samvermette/SVWebViewController)来处理从shouldStartLoadWithRequest创建Web浏览器

动画代码来自http://www.theappcodeblog.com/2011/06/02/iphone-app-animation-tutorial-animate-a-uiview-frame/

一切正常,因为导航栏被放置在屏幕外,但留下的空间(我想将其设置为动画)是黑色的.视图/ webview的其余部分是WHITE.

如何将空间分配给导航栏白色,即视图的背景为白色?没有xib.

我在SVWebViewController中找不到任何提示导航栏(只添加一个工具栏)

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSLog(@"They clicked: %@", request);

    NSURL *requestURL = [request URL];

    if ([[requestURL scheme ] isEqualToString: @"http"] || [[requestURL scheme] isEqualToString: @"https"]) {


            NSLog(@"Web link %@",requestURL);

            SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithURL:requestURL];
            webViewController.modalPresentationStyle = UIModalPresentationFullScreen;
            webViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

            webViewController.availableActions = SVWebViewControllerAvailableActionsOpenInSafari | SVWebViewControllerAvailableActionsCopyLink | SVWebViewControllerAvailableActionsMailLink;

            // ios5

            if ([[UINavigationBar class]respondsToSelector:@selector(appearance)]) {

                // Create image for navigation background - portrait
                UIImage *NavigationPortraitBackground = [[UIImage imageNamed:@"navbar_bg_portrait~iPad"]
                                                         resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, …
Run Code Online (Sandbox Code Playgroud)

iphone uinavigationbar uiwebview uinavigationcontroller ios

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

困惑于UITableView numberOfRowsInSection语法

我有一个标签视图,为每个标签加载一个表格视图

第一个选项卡界面声明UITableView*tableView; 第二个选项卡界面声明UITableView*favTableView;

当声明第二个表的行数时,这有效:

- (NSInteger)tableView:(UITableView *)favTableView numberOfRowsInSection:(NSInteger)section {
    return [favList count];
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我将其更改为:

- (NSInteger)favTableView:(UITableView *)favTableView numberOfRowsInSection:(NSInteger)section {
    return [favList count];
}
Run Code Online (Sandbox Code Playgroud)

当我尝试加载第二个标签时,应用程序崩溃了

是我的错误(a)不理解哪个是变量/保留字,(b)给每个表一个唯一的标识符,即favTableView,而不是重用tableView.

第二个表也没有标题栏

iphone xcode

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

子类?UITabBarController不会自动旋转

诺比如此忍受我.

我一直在关注O'Rielyy学习iPhone编程和各种线程来构建我的第一个iPhone应用程序.到目前为止一切都那么好,但项目结束的最后绊脚石是让App自动旋转(仅使用uiwebviews的beta因不自动旋转而被拒绝)

我有邮件App委托,它添加了一个UITabBarController

// myNewsUKDelegate.h
@interface myNewsUKDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@end

// myNewsUKDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Add the tab bar controller's view to the window and display.
    [self.window addSubview:tabBarController.view];
    [self.window makeKeyAndVisible];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

tabBarController有.h和.m文件 - 我在IB中添加了所有UINavigationControllers,后者又添加了一个UITableView

请参阅http://flatearth.co.uk/nib.png上的图片(也是noob,在问题中发布图片!)

从我的阅读中我明白问题是我添加到主视图的UITabBarController需要'子类'并添加了这个代码.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

下一个视图down/in/subclassed(无论正确的术语是什么),其中包含.h和.m文件的是FirstViewController,它添加了表视图,这已经设置了shouldAutorotateToInterfaceOrientation.

@interface FirstViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
    UITableView *tableView; …
Run Code Online (Sandbox Code Playgroud)

iphone xcode uitabbarcontroller autorotate

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