当前位置: 首页>>代码示例>>Java>>正文


Java NSError类代码示例

本文整理汇总了Java中org.robovm.apple.foundation.NSError的典型用法代码示例。如果您正苦于以下问题:Java NSError类的具体用法?Java NSError怎么用?Java NSError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NSError类属于org.robovm.apple.foundation包,在下文中一共展示了NSError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: add

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
private void add() {
	// bmob
	Bmob.registerWithAppKey("34b7704a3b372576a732b7675abce9e8");
	// Gdx.app.log("xxx", "showInterAd");
	System.out.println("showInterAd");
	final BmobObject gameScore = new BmobObject("GameScore");
	gameScore.setObject(new NSString("小明"), "playerName");
	gameScore.setObject(NSNumber.valueOf(100), "playerScore");
	gameScore.setObject(NSNumber.valueOf(true), "cheatMode");

	gameScore.saveInBackgroundWithResultBlock(new BmobBooleanResultBlock() {
		@Override
		public void invoke(boolean isSuccessful, NSError error) {
			if (isSuccessful) {
				System.out.println("success");
				System.out.println(gameScore.getObjectId());
				System.out.println(Bmob.getServerTimestamp());
				query();
			} else {
				System.out.println(error.getErrorCode() + error.getDomain());
			}
		}
	});
	System.out.println("showInterAd ---- end");
}
 
开发者ID:tianqiujie,项目名称:robovm-ios-bindings,代码行数:26,代码来源:IOSLauncher.java

示例2: logIn

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
public void logIn(final List<String> readPermissions, final LoginListener listener) {
    log("Trying to login with read permissions (%s)...", readPermissions);
    loginManager.logInWithReadPermissions(readPermissions,
            new VoidBlock2<FBSDKLoginManagerLoginResult, NSError>() {
                @Override
                public void invoke(FBSDKLoginManagerLoginResult result, NSError error) {
                    if (error != null) {
                        log("Failed to login: %s", error.getLocalizedDescription());
                        listener.onError("An unknown error happened!");
                    } else if (result.isCancelled()) {
                        log("Cancelled login!");
                        listener.onCancel();
                    } else {
                        if (!result.getGrantedPermissions().containsAll(readPermissions)) {
                            log("Failed to login: Permissions declined (%s)", result.getDeclinedPermissions());
                            listener.onError("The following permissions have been declined: "
                                    + result.getDeclinedPermissions().toString());
                        } else {
                            log("Successfully logged in!");
                            listener.onSuccess();
                        }
                    }
                }
            });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:26,代码来源:FacebookHandler.java

示例3: requestPublishPermissions

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
public void requestPublishPermissions(final List<String> publishPermissions, final LoginListener listener) {
    log("Requesting publish permissions (%s)...", publishPermissions);
    loginManager.logInWithPublishPermissions(publishPermissions,
            new VoidBlock2<FBSDKLoginManagerLoginResult, NSError>() {
                @Override
                public void invoke(FBSDKLoginManagerLoginResult result, NSError error) {
                    if (error != null) {
                        log("Failed to request publish permissions: %s", error);
                        listener.onError("An unknown error happened!");
                    } else if (result.isCancelled()) {
                        log("Cancelled request for publish permissions!");
                        listener.onCancel();
                    } else {
                        if (!result.getGrantedPermissions().containsAll(publishPermissions)) {
                            log("Failed to request publish permissions: Permissions declined (%s)",
                                    result.getDeclinedPermissions());
                            listener.onError("The following permissions have been declined: "
                                    + result.getDeclinedPermissions().toString());
                        } else {
                            log("Successfully requested publish permissions");
                            listener.onSuccess();
                        }
                    }
                }
            });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:27,代码来源:FacebookHandler.java

示例4: makeIncrementalProgress

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
private void makeIncrementalProgress(Achievement achievement, int progressAmount) {
    Log.d("Your progress amount is %d", progressAmount);

    final GPGAchievement incrementMe = new GPGAchievement(achievement.getId());

    incrementMe.incrementSteps(progressAmount, new GPGAchievementIncrementStepsCallback() {
        @Override
        public void done(boolean newlyUnlocked, int currentSteps, NSError error) {
            if (error != null) {
                Log.e("Received an error attempting to increment achievement %s: %s", incrementMe, error);
            } else if (newlyUnlocked) {
                Log.d("Incremental achievement unlocked!");
            } else {
                Log.d("You've completed %d steps total", currentSteps);
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:19,代码来源:AchievementManager.java

示例5: playerFinishedGame

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
public void playerFinishedGame(int score, DifficultyLevel level, final ScoreSubmitCallback callback) {
    Leaderboard leaderboard = getLeaderboard(level);

    final GPGScore submitMe = GPGScore.getScore(leaderboard.getId());
    submitMe.setValue(score);

    submitMe.submitScore(new GPGScoreReportCallback() {
        @Override
        public void done(GPGScoreReport report, NSError error) {
            if (error != null) {
                Log.e("Received an error attempting to add to leaderboard %s: %s", submitMe, error);
                callback.onError(error);
            } else {
                if (report.isHighScoreForLocalPlayerToday()) {
                    Log.d("Woo hoo! Daily high score!");
                }
                callback.onSuccess(report);
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:22,代码来源:LeaderboardManager.java

示例6: setFile

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
public void setFile(PFFile file) {
    final String requestURL = file.getUrl(); // Save copy of url locally
    url = file.getUrl(); // Save copy of url on the instance

    file.getDataInBackground(new PFGetDataCallback() {
        @Override
        public void done(NSData data, NSError error) {
            if (error == null) {
                UIImage image = new UIImage(data);
                if (requestURL.equals(url)) {
                    setImage(image);
                    setNeedsDisplay();
                }
            } else {
                Log.e("Error on fetching file: %s", error);
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:20,代码来源:PAPImageView.java

示例7: didLoadObjects

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
@Override
public void didLoadObjects(NSError error) {
    super.didLoadObjects(error);

    if (getObjects().size() == 0 && !getQuery().hasCachedResult() && !firstLaunch) {
        getTableView().setScrollEnabled(false);

        if (blankTimelineView.getSuperview() == null) {
            blankTimelineView.setAlpha(0);
            getTableView().setTableHeaderView(blankTimelineView);

            UIView.animate(0.2, new Runnable() {
                @Override
                public void run() {
                    blankTimelineView.setAlpha(1);
                }
            });
        }
    } else {
        getTableView().setTableHeaderView(null);
        getTableView().setScrollEnabled(true);
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:24,代码来源:PAPHomeViewController.java

示例8: onClick

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
@Override
public void onClick(UIBarButtonItem barButtonItem) {
    UIActivityIndicatorView loadingActivityIndicatorView = new UIActivityIndicatorView(
            UIActivityIndicatorViewStyle.White);
    loadingActivityIndicatorView.startAnimating();
    getNavigationItem().setRightBarButtonItem(new UIBarButtonItem(loadingActivityIndicatorView));

    configureUnfollowButton();

    PAPUtility.followUserEventually(user, new PFSaveCallback() {
        @Override
        public void done(boolean success, NSError error) {
            if (error != null) {
                configureFollowButton();
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:19,代码来源:PAPAccountViewController.java

示例9: shouldToggleFollowFriendForCell

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
private void shouldToggleFollowFriendForCell(final PAPFindFriendsCell cell) {
    PAPUser cellUser = cell.getUser();
    if (cell.getFollowButton().isSelected()) {
        // Unfollow
        cell.getFollowButton().setSelected(false);
        PAPUtility.unfollowUserEventually(cellUser);
        PAPNotificationManager.postNotification(PAPNotification.USER_FOLLOWING_CHANGED);
    } else {
        // Follow
        cell.getFollowButton().setSelected(true);
        PAPUtility.followUserEventually(cellUser, new PFSaveCallback() {
            @Override
            public void done(boolean success, NSError error) {
                if (error == null) {
                    PAPNotificationManager.postNotification(PAPNotification.USER_FOLLOWING_CHANGED);
                } else {
                    cell.getFollowButton().setSelected(false);
                }
            }
        });
    }
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:23,代码来源:PAPFindFriendsViewController.java

示例10: viewDidLoad

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
@Override
public void viewDidLoad() {
    super.viewDidLoad();

    FBSDKProfile.Notifications.observeCurrentProfileDidChange(new VoidBlock1<FBSDKProfileChangeNotification>() {
        @Override
        public void invoke(FBSDKProfileChangeNotification notification) {
            if (FBSDKProfile.getCurrentProfile() != null && PAPUser.getCurrentUser() != null) {
                PAPUser.getCurrentUser().fetchInBackground(new PFGetCallback<PAPUser>() {
                    @Override
                    public void done(PAPUser object, NSError error) {
                        refreshCurrentUser(object, error);
                    }
                });
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:19,代码来源:PAPWelcomeViewController.java

示例11: viewWillAppear

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
@Override
public void viewWillAppear(boolean animated) {
    super.viewWillAppear(animated);

    if (PAPUser.getCurrentUser() == null) {
        presentLoginViewController(false);
        return;
    }

    // Present Anypic UI
    ((AnyPicApp) UIApplication.getSharedApplication().getDelegate()).presentTabBarController();

    // Refresh current user with server side data -- checks if user is still
    // valid and so on
    facebookResponseCount = 0;
    PAPUser.getCurrentUser().fetchInBackground(new PFGetCallback<PAPUser>() {
        @Override
        public void done(PAPUser object, NSError error) {
            if (FBSDKProfile.getCurrentProfile() != null) {
                refreshCurrentUser(object, error);
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:25,代码来源:PAPWelcomeViewController.java

示例12: processedFacebookResponse

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
private void processedFacebookResponse() {
    // Once we handled all necessary facebook batch responses, save
    // everything necessary and continue
    synchronized (this) {
        facebookResponseCount++;
        if (facebookResponseCount != expectedFacebookResponseCount) {
            return;
        }
    }
    facebookResponseCount = 0;
    Log.d("done processing all Facebook requests");

    PAPUser.getCurrentUser().saveInBackground(new PFSaveCallback() {
        @Override
        public void done(boolean success, NSError error) {
            if (!success) {
                Log.e("Failed save in background of user, %s", error);
            } else {
                Log.d("saved current parse user");
            }
        }
    });
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:24,代码来源:PAPWelcomeViewController.java

示例13: onClick

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
@Override
        public void onClick(UIBarButtonItem barButtonItem) {
            if (photo.getPicture().isDataAvailable()) {
                showShareSheet();
            } else {
//        [MBProgressHUD showHUDAddedTo:self.view animated:YES]; TODO
                photo.getPicture().getDataInBackground(new PFGetDataCallback() {
                    @Override
                    public void done(NSData data, NSError error) {
//            [MBProgressHUD hideHUDForView:self.view animated:YES]; TODO
                        if (error == null) {
                            showShareSheet();
                        }
                    }
                });
            }
        }
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:18,代码来源:PAPPhotoDetailsViewController.java

示例14: shouldDeletePhoto

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
private void shouldDeletePhoto() {
    // Delete all activites related to this photo
    PFQuery<PAPActivity> query = PFQuery.getQuery(PAPActivity.class);
    query.whereEqualTo(PAPActivity.PHOTO_KEY, photo);
    query.findInBackground(new PFFindCallback<PAPActivity>() {
        @Override
        public void done(NSArray<PAPActivity> objects, NSError error) {
            if (error == null) {
                for (PAPActivity activity : objects) {
                    activity.deleteEventually();
                }
            }

            // Delete photo
            photo.deleteEventually();
        }
    });
    PAPNotificationManager.postNotification(PAPNotification.USER_DELETED_PHOTO, photo.getObjectId());
    getNavigationController().popViewController(true);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:21,代码来源:PAPPhotoDetailsViewController.java

示例15: unfollowUserEventually

import org.robovm.apple.foundation.NSError; //导入依赖的package包/类
public static void unfollowUserEventually(PAPUser user) {
    PFQuery<PAPActivity> query = PFQuery.getQuery(PAPActivity.class);
    query.whereEqualTo(PAPActivity.FROM_USER_KEY, PAPUser.getCurrentUser());
    query.whereEqualTo(PAPActivity.TO_USER_KEY, user);
    query.whereEqualTo(PAPActivity.TYPE_KEY, PAPActivityType.FOLLOW.getKey());
    query.findInBackground(new PFFindCallback<PAPActivity>() {
        @Override
        public void done(NSArray<PAPActivity> activities, NSError error) {
            // While normally there should only be one follow activity
            // returned, we can't guarantee that.
            if (error == null) {
                for (PAPActivity activity : activities) {
                    activity.deleteEventually();
                }
            }
        }
    });
    PAPCache.getSharedCache().setUserFollowStatus(user, false);
}
 
开发者ID:robovm,项目名称:robovm-samples,代码行数:20,代码来源:PAPUtility.java


注:本文中的org.robovm.apple.foundation.NSError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。